You an now pass a file mode to write_file with "mode=" and
it will set the file mode that after writing the file.
Signed-off-by: Travis Rhoden <trhoden@redhat.com>
write_file(keyring, monitor_keyring)
-def write_file(path, content, directory=None):
+def write_file(path, content, mode=0644, directory=None):
if directory:
if path.startswith("/"):
path = path[1:]
path = os.path.join(directory, path)
- with file(path, 'w') as f:
+ with os.fdopen(os.open(path, os.O_WRONLY | os.O_CREAT, mode), 'w') as f:
f.write(content)