diff options
author | Tim Small <tim@seoss.co.uk> | 2023-05-31 15:19:23 +0100 |
---|---|---|
committer | Tim Small <tim@seoss.co.uk> | 2023-05-31 15:19:23 +0100 |
commit | a59e8323f1a4e149cb2600952e146ff98d74cf38 (patch) | |
tree | c2927599fc61bf55826a795e2e81ba9e0f0fe4c1 | |
parent | e4d591ae30dbf18e43d594a0ba2d281ca8900691 (diff) | |
download | vmdb2-a59e8323f1a4e149cb2600952e146ff98d74cf38.tar.gz |
Bugfix /etc/default/grub could end up with remnant of previous contents.
Commit 8a9977b introduced a bug whereby if the new /etc/default/grub
file contents were shorter in overall length than the original content,
then a trailing portion of the previous content would remain in the
file. This commit ensures that the new file is truncated to the new
length to prevent this.
-rw-r--r-- | vmdb/plugins/grub_plugin.py | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/vmdb/plugins/grub_plugin.py b/vmdb/plugins/grub_plugin.py index 6ce92f0..a0d8479 100644 --- a/vmdb/plugins/grub_plugin.py +++ b/vmdb/plugins/grub_plugin.py @@ -387,6 +387,7 @@ class GrubStepRunner(vmdb.StepRunnerInterface): if found_param: f.seek(0) f.write(newcontents) + f.truncate() else: f.write(newdefault) |