summaryrefslogtreecommitdiff
path: root/cloudinit/config/cc_disk_setup.py
diff options
context:
space:
mode:
Diffstat (limited to 'cloudinit/config/cc_disk_setup.py')
-rw-r--r--cloudinit/config/cc_disk_setup.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/cloudinit/config/cc_disk_setup.py b/cloudinit/config/cc_disk_setup.py
index e903dd4d..0b970e4e 100644
--- a/cloudinit/config/cc_disk_setup.py
+++ b/cloudinit/config/cc_disk_setup.py
@@ -484,12 +484,13 @@ def get_partition_mbr_layout(size, layout):
def purge_disk_ptable(device):
# wipe the first and last megabyte of a disk (or file)
# gpt stores partition table both at front and at end.
+ null = '\0' # pylint: disable=W1401
start_len = 1024 * 1024
end_len = 1024 * 1024
with open(device, "rb+") as fp:
- fp.write('\0' * (start_len))
+ fp.write(null * (start_len))
fp.seek(-end_len, os.SEEK_END)
- fp.write('\0' * end_len)
+ fp.write(null * end_len)
fp.flush()
read_parttbl(device)