From d7ac2a84990ca82b609bf6b9cafa76e12eb5d898 Mon Sep 17 00:00:00 2001 From: Michael Scherer Date: Tue, 17 May 2016 19:33:12 +0200 Subject: [PATCH] Use a python3 compatible notation for octal (#2238) --- lib/ansible/modules/extras/cloud/lxc/lxc_container.py | 4 ++-- lib/ansible/modules/extras/monitoring/boundary_meter.py | 2 +- lib/ansible/modules/extras/system/cronvar.py | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/ansible/modules/extras/cloud/lxc/lxc_container.py b/lib/ansible/modules/extras/cloud/lxc/lxc_container.py index da9c486a86..bd77425e3e 100644 --- a/lib/ansible/modules/extras/cloud/lxc/lxc_container.py +++ b/lib/ansible/modules/extras/cloud/lxc/lxc_container.py @@ -568,7 +568,7 @@ def create_script(command): f.close() # Ensure the script is executable. - os.chmod(script_file, 0700) + os.chmod(script_file, int('0700',8)) # Output log file. stdout_file = os.fdopen(tempfile.mkstemp(prefix='lxc-attach-script-log')[0], 'ab') @@ -1371,7 +1371,7 @@ class LxcContainerManagement(object): :type source_dir: ``str`` """ - old_umask = os.umask(0077) + old_umask = os.umask(int('0077',8)) archive_path = self.module.params.get('archive_path') if not os.path.isdir(archive_path): diff --git a/lib/ansible/modules/extras/monitoring/boundary_meter.py b/lib/ansible/modules/extras/monitoring/boundary_meter.py index ef681704f0..3729b606a1 100644 --- a/lib/ansible/modules/extras/monitoring/boundary_meter.py +++ b/lib/ansible/modules/extras/monitoring/boundary_meter.py @@ -220,7 +220,7 @@ def download_request(module, name, apiid, apikey, cert_type): cert_file = open(cert_file_path, 'w') cert_file.write(body) cert_file.close() - os.chmod(cert_file_path, 0600) + os.chmod(cert_file_path, int('0600', 8)) except: module.fail_json("Could not write to certificate file") diff --git a/lib/ansible/modules/extras/system/cronvar.py b/lib/ansible/modules/extras/system/cronvar.py index 50afe26e30..1873c9d09c 100644 --- a/lib/ansible/modules/extras/system/cronvar.py +++ b/lib/ansible/modules/extras/system/cronvar.py @@ -363,7 +363,7 @@ def main(): res_args = dict() # 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) module.debug('cronvar instantiated - name: "%s"' % name)