Skip to content

Commit

Permalink
Merge pull request ansible#10687 from ianzd/devel
Browse files Browse the repository at this point in the history
Several more changes to support python3 syntax.
  • Loading branch information
abadger committed Apr 13, 2015
2 parents 483c8d3 + 1bdf0bb commit 4bbca92
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion v2/ansible/plugins/action/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 4 additions & 4 deletions v2/ansible/plugins/lookup/password.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ def run(self, terms, variables, **kwargs):
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)))

Expand All @@ -111,7 +111,7 @@ def run(self, terms, variables, **kwargs):
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()
Expand All @@ -129,12 +129,12 @@ def run(self, terms, variables, **kwargs):
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:
Expand Down

0 comments on commit 4bbca92

Please sign in to comment.