summaryrefslogtreecommitdiff
path: root/cloudinit/config
diff options
context:
space:
mode:
authorStefan Prietl <ederst@users.noreply.github.com>2023-02-13 19:26:23 +0100
committerGitHub <noreply@github.com>2023-02-13 11:26:23 -0700
commitbb414c7866c4728b2105e84f7b426ab81cc4bf4d (patch)
treeef9954976803a1ee836b097972a2cc0bb3a8d66b /cloudinit/config
parent55686b977570a6de69bef51c1e1a9d452333995d (diff)
downloadcloud-init-git-bb414c7866c4728b2105e84f7b426ab81cc4bf4d.tar.gz
disk_setup: use byte string when purging the partition table (#2012)
This writes a byte string to the device instead of a string when purging the partition table. Essentially, this will prevent the error "a bytes-like object is required, not 'str'" from happening.
Diffstat (limited to 'cloudinit/config')
-rw-r--r--cloudinit/config/cc_disk_setup.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/cloudinit/config/cc_disk_setup.py b/cloudinit/config/cc_disk_setup.py
index 0248e7ec..4aae5530 100644
--- a/cloudinit/config/cc_disk_setup.py
+++ b/cloudinit/config/cc_disk_setup.py
@@ -657,7 +657,7 @@ def get_partition_gpt_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"
+ null = b"\0"
start_len = 1024 * 1024
end_len = 1024 * 1024
with open(device, "rb+") as fp: