mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-05-07 13:52:54 +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:
@@ -120,7 +120,7 @@ class DocCLI(CLI):
|
||||
# this typically means we couldn't even parse the docstring, not just that the YAML is busted,
|
||||
# probably a quoting issue.
|
||||
raise AnsibleError("Parsing produced an empty object.")
|
||||
except Exception, e:
|
||||
except Exception as e:
|
||||
self.display.vvv(traceback.print_exc())
|
||||
raise AnsibleError("module %s missing documentation (or could not parse documentation): %s\n" % (module, str(e)))
|
||||
|
||||
|
||||
@@ -196,7 +196,7 @@ class PullCLI(CLI):
|
||||
os.chdir('/')
|
||||
try:
|
||||
shutil.rmtree(self.options.dest)
|
||||
except Exception, e:
|
||||
except Exception as e:
|
||||
self.display.error("Failed to remove %s: %s" % (self.options.dest, str(e)))
|
||||
|
||||
return rc
|
||||
|
||||
Reference in New Issue
Block a user