From 1bdf0bb0d67849d96aa1b29713af6643e35d148f Mon Sep 17 00:00:00 2001 From: ian Date: Mon, 13 Apr 2015 15:37:25 -0400 Subject: [PATCH] Several more changes to suport python3 syntax. --- v2/ansible/plugins/action/__init__.py | 2 +- v2/ansible/plugins/lookup/password.py | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/v2/ansible/plugins/action/__init__.py b/v2/ansible/plugins/action/__init__.py index 0e98bbc5b75..be83539def6 100644 --- a/v2/ansible/plugins/action/__init__.py +++ b/v2/ansible/plugins/action/__init__.py @@ -19,7 +19,7 @@ from __future__ import (absolute_import, division, print_function) __metaclass__ = type -import StringIO +from six.moves import StringIO import json import os import random diff --git a/v2/ansible/plugins/lookup/password.py b/v2/ansible/plugins/lookup/password.py index 7e812a38c5f..74017eff619 100644 --- a/v2/ansible/plugins/lookup/password.py +++ b/v2/ansible/plugins/lookup/password.py @@ -98,7 +98,7 @@ class LookupModule(LookupBase): pathdir = os.path.dirname(path) if not os.path.isdir(pathdir): try: - os.makedirs(pathdir, mode=0700) + os.makedirs(pathdir, mode=0o700) except OSError as e: raise AnsibleError("cannot create the path for the password lookup: %s (error was %s)" % (pathdir, str(e))) @@ -111,7 +111,7 @@ class LookupModule(LookupBase): else: content = password with open(path, 'w') as f: - os.chmod(path, 0600) + os.chmod(path, 0o600) f.write(content + '\n') else: content = open(path).read().rstrip() @@ -129,12 +129,12 @@ class LookupModule(LookupBase): salt = self.random_salt() content = '%s salt=%s' % (password, salt) with open(path, 'w') as f: - os.chmod(path, 0600) + os.chmod(path, 0o600) f.write(content + '\n') # crypt not requested, remove salt if present elif (encrypt is None and salt): with open(path, 'w') as f: - os.chmod(path, 0600) + os.chmod(path, 0o600) f.write(password + '\n') if encrypt: