mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-07-22 21:00:22 -07:00
Python3 fixes
This commit is contained in:
parent
a954220957
commit
e78c5f925b
6 changed files with 22 additions and 11 deletions
|
@ -219,5 +219,5 @@ def load_data_from_file(path, vault_password=None):
|
|||
|
||||
try:
|
||||
return load_data(data)
|
||||
except YAMLError, exc:
|
||||
except YAMLError as exc:
|
||||
process_yaml_error(exc, data, path, show_content)
|
||||
|
|
|
@ -191,7 +191,7 @@ class VaultEditor(object):
|
|||
raise errors.AnsibleError("%s exists, please use 'edit' instead" % self.filename)
|
||||
|
||||
# drop the user into vim on file
|
||||
old_umask = os.umask(0077)
|
||||
old_umask = os.umask(0o077)
|
||||
call(self._editor_shell_command(self.filename))
|
||||
tmpdata = self.read_data(self.filename)
|
||||
this_vault = VaultLib(self.password)
|
||||
|
@ -225,7 +225,7 @@ class VaultEditor(object):
|
|||
raise errors.AnsibleError(CRYPTO_UPGRADE)
|
||||
|
||||
# make sure the umask is set to a sane value
|
||||
old_mask = os.umask(0077)
|
||||
old_mask = os.umask(0o077)
|
||||
|
||||
# decrypt to tmpfile
|
||||
tmpdata = self.read_data(self.filename)
|
||||
|
|
|
@ -37,7 +37,7 @@ class Base:
|
|||
# each class knows attributes set upon it, see Task.py for example
|
||||
self._attributes = dict()
|
||||
|
||||
for (name, value) in self._get_base_attributes().iteritems():
|
||||
for (name, value) in iteritems(self._get_base_attributes()):
|
||||
self._attributes[name] = value.default
|
||||
|
||||
def _get_base_attributes(self):
|
||||
|
@ -72,7 +72,7 @@ class Base:
|
|||
ds = self.munge(ds)
|
||||
|
||||
# walk all attributes in the class
|
||||
for (name, attribute) in self._get_base_attributes().iteritems():
|
||||
for (name, attribute) in iteritems(self._get_base_attributes()):
|
||||
|
||||
# copy the value over unless a _load_field method is defined
|
||||
if name in ds:
|
||||
|
@ -91,7 +91,7 @@ class Base:
|
|||
''' validation that is done at parse time, not load time '''
|
||||
|
||||
# walk all fields in the object
|
||||
for (name, attribute) in self._get_base_attributes().iteritems():
|
||||
for (name, attribute) in iteritems(self._get_base_attributes()):
|
||||
|
||||
# run validator only if present
|
||||
method = getattr(self, '_validate_%s' % name, None)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue