Use a python3 compatible notation for octal (#2238)

This commit is contained in:
Michael Scherer 2016-05-17 19:33:12 +02:00 committed by Toshio Kuratomi
parent 7e97b2131b
commit c8864c3220
3 changed files with 4 additions and 4 deletions

View file

@ -568,7 +568,7 @@ def create_script(command):
f.close() f.close()
# Ensure the script is executable. # Ensure the script is executable.
os.chmod(script_file, 0700) os.chmod(script_file, int('0700',8))
# Output log file. # Output log file.
stdout_file = os.fdopen(tempfile.mkstemp(prefix='lxc-attach-script-log')[0], 'ab') stdout_file = os.fdopen(tempfile.mkstemp(prefix='lxc-attach-script-log')[0], 'ab')
@ -1371,7 +1371,7 @@ class LxcContainerManagement(object):
:type source_dir: ``str`` :type source_dir: ``str``
""" """
old_umask = os.umask(0077) old_umask = os.umask(int('0077',8))
archive_path = self.module.params.get('archive_path') archive_path = self.module.params.get('archive_path')
if not os.path.isdir(archive_path): if not os.path.isdir(archive_path):

View file

@ -220,7 +220,7 @@ def download_request(module, name, apiid, apikey, cert_type):
cert_file = open(cert_file_path, 'w') cert_file = open(cert_file_path, 'w')
cert_file.write(body) cert_file.write(body)
cert_file.close() cert_file.close()
os.chmod(cert_file_path, 0600) os.chmod(cert_file_path, int('0600', 8))
except: except:
module.fail_json("Could not write to certificate file") module.fail_json("Could not write to certificate file")

View file

@ -363,7 +363,7 @@ def main():
res_args = dict() res_args = dict()
# Ensure all files generated are only writable by the owning user. Primarily relevant for the cron_file option. # Ensure all files generated are only writable by the owning user. Primarily relevant for the cron_file option.
os.umask(022) os.umask(int('022',8))
cronvar = CronVar(module, user, cron_file) cronvar = CronVar(module, user, cron_file)
module.debug('cronvar instantiated - name: "%s"' % name) module.debug('cronvar instantiated - name: "%s"' % name)