summaryrefslogtreecommitdiff
path: root/cloudinit/util.py
diff options
context:
space:
mode:
Diffstat (limited to 'cloudinit/util.py')
-rw-r--r--cloudinit/util.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/cloudinit/util.py b/cloudinit/util.py
index 415ca374..ec68925e 100644
--- a/cloudinit/util.py
+++ b/cloudinit/util.py
@@ -1751,8 +1751,12 @@ def write_file(filename, content, mode=0o644, omode="wb", copy_mode=False):
else:
content = decode_binary(content)
write_type = 'characters'
+ try:
+ mode_r = "%o" % mode
+ except TypeError:
+ mode_r = "%r" % mode
LOG.debug("Writing to %s - %s: [%s] %s %s",
- filename, omode, mode, len(content), write_type)
+ filename, omode, mode_r, len(content), write_type)
with SeLinuxGuard(path=filename):
with open(filename, omode) as fh:
fh.write(content)