summaryrefslogtreecommitdiff
path: root/cloudinit/util.py
diff options
context:
space:
mode:
authorBarry Warsaw <barry@python.org>2015-01-21 15:35:56 -0500
committerBarry Warsaw <barry@python.org>2015-01-21 15:35:56 -0500
commitcccc0ff012d2e7b5c238609b22cc064b519e54a5 (patch)
tree1ca463be706ede0f0b3f0d967f67de79d13e5793 /cloudinit/util.py
parent463d626ba53e54160f350d84831e1877b24f4024 (diff)
downloadvyos-cloud-init-cccc0ff012d2e7b5c238609b22cc064b519e54a5.tar.gz
vyos-cloud-init-cccc0ff012d2e7b5c238609b22cc064b519e54a5.zip
Fix file modes to be Python 2/3 compatible.
Diffstat (limited to 'cloudinit/util.py')
-rw-r--r--cloudinit/util.py8
1 files changed, 4 insertions, 4 deletions
diff --git a/cloudinit/util.py b/cloudinit/util.py
index bf8e7d80..9efc704a 100644
--- a/cloudinit/util.py
+++ b/cloudinit/util.py
@@ -1250,7 +1250,7 @@ def rename(src, dest):
os.rename(src, dest)
-def ensure_dirs(dirlist, mode=0755):
+def ensure_dirs(dirlist, mode=0o755):
for d in dirlist:
ensure_dir(d, mode)
@@ -1264,7 +1264,7 @@ def read_write_cmdline_url(target_fn):
return
try:
if key and content:
- write_file(target_fn, content, mode=0600)
+ write_file(target_fn, content, mode=0o600)
LOG.debug(("Wrote to %s with contents of command line"
" url %s (len=%s)"), target_fn, url, len(content))
elif key and not content:
@@ -1489,7 +1489,7 @@ def append_file(path, content):
write_file(path, content, omode="ab", mode=None)
-def ensure_file(path, mode=0644):
+def ensure_file(path, mode=0o644):
write_file(path, content='', omode="ab", mode=mode)
@@ -1507,7 +1507,7 @@ def chmod(path, mode):
os.chmod(path, real_mode)
-def write_file(filename, content, mode=0644, omode="wb"):
+def write_file(filename, content, mode=0o644, omode="wb"):
"""
Writes a file with the given content and sets the file mode as specified.
Resotres the SELinux context if possible.