mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-04-25 03:41:25 -07:00
Use 'except ... as' syntax
This syntax works on Python 2.6 through 3.x. lib/ansible/module_utils (and lib/ansible/modules) need to support Python 2.4, so I didn't touch those.
This commit is contained in:
parent
2ac931d6c9
commit
0c6ce31f76
24 changed files with 51 additions and 51 deletions
|
@ -47,7 +47,7 @@ class LookupModule(LookupBase):
|
|||
# Retrieve a single value
|
||||
try:
|
||||
value = self.cp.get(section, key)
|
||||
except ConfigParser.NoOptionError, e:
|
||||
except ConfigParser.NoOptionError as e:
|
||||
return dflt
|
||||
return value
|
||||
|
||||
|
@ -76,7 +76,7 @@ class LookupModule(LookupBase):
|
|||
name, value = param.split('=')
|
||||
assert(name in paramvals)
|
||||
paramvals[name] = value
|
||||
except (ValueError, AssertionError), e:
|
||||
except (ValueError, AssertionError) as e:
|
||||
raise errors.AnsibleError(e)
|
||||
|
||||
path = self._loader.path_dwim_relative(basedir, 'files', paramvals['file'])
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue