summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xbin/cloud-init2
-rw-r--r--cloudinit/config/cc_bootcmd.py2
2 files changed, 2 insertions, 2 deletions
diff --git a/bin/cloud-init b/bin/cloud-init
index d67b2b6d..6c83c2e7 100755
--- a/bin/cloud-init
+++ b/bin/cloud-init
@@ -428,7 +428,7 @@ def atomic_write_json(path, data):
try:
tf = tempfile.NamedTemporaryFile(dir=os.path.dirname(path),
delete=False)
- tf.write((json.dumps(data, indent=1) + "\n").encode())
+ tf.write(util.encode_text(json.dumps(data, indent=1) + "\n"))
tf.close()
os.rename(tf.name, path)
except Exception as e:
diff --git a/cloudinit/config/cc_bootcmd.py b/cloudinit/config/cc_bootcmd.py
index 3ac22967..a295cc4e 100644
--- a/cloudinit/config/cc_bootcmd.py
+++ b/cloudinit/config/cc_bootcmd.py
@@ -36,7 +36,7 @@ def handle(name, cfg, cloud, log, _args):
with util.ExtendedTemporaryFile(suffix=".sh") as tmpf:
try:
content = util.shellify(cfg["bootcmd"])
- tmpf.write(content)
+ tmpf.write(util.encode_text(content))
tmpf.flush()
except:
util.logexc(log, "Failed to shellify bootcmd")