mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-05-08 14:22:46 +00: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:
@@ -32,7 +32,7 @@ class LookupModule(LookupBase):
|
||||
for x in terms:
|
||||
try:
|
||||
intermediate = listify_lookup_plugin_terms(x, templar=self._templar, loader=self._loader, fail_on_undefined=True)
|
||||
except UndefinedError, e:
|
||||
except UndefinedError as e:
|
||||
raise AnsibleUndefinedVariable("One of the nested variables was undefined. The error was: %s" % e)
|
||||
results.append(intermediate)
|
||||
return results
|
||||
|
||||
Reference in New Issue
Block a user