use encode_text
This commit is contained in:
parent
dc34848256
commit
4e9c73303c
@ -428,7 +428,7 @@ def atomic_write_json(path, data):
|
|||||||
try:
|
try:
|
||||||
tf = tempfile.NamedTemporaryFile(dir=os.path.dirname(path),
|
tf = tempfile.NamedTemporaryFile(dir=os.path.dirname(path),
|
||||||
delete=False)
|
delete=False)
|
||||||
tf.write((json.dumps(data, indent=1) + "\n").encode())
|
tf.write(util.encode_text(json.dumps(data, indent=1) + "\n"))
|
||||||
tf.close()
|
tf.close()
|
||||||
os.rename(tf.name, path)
|
os.rename(tf.name, path)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
|
@ -36,7 +36,7 @@ def handle(name, cfg, cloud, log, _args):
|
|||||||
with util.ExtendedTemporaryFile(suffix=".sh") as tmpf:
|
with util.ExtendedTemporaryFile(suffix=".sh") as tmpf:
|
||||||
try:
|
try:
|
||||||
content = util.shellify(cfg["bootcmd"])
|
content = util.shellify(cfg["bootcmd"])
|
||||||
tmpf.write(content)
|
tmpf.write(util.encode_text(content))
|
||||||
tmpf.flush()
|
tmpf.flush()
|
||||||
except:
|
except:
|
||||||
util.logexc(log, "Failed to shellify bootcmd")
|
util.logexc(log, "Failed to shellify bootcmd")
|
||||||
|
Loading…
x
Reference in New Issue
Block a user