mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-05-08 14:22:46 +00:00
Fixed modules/system py files for 2.4 to 3.5 exceptions (#2367)
This commit is contained in:
@@ -80,6 +80,9 @@ EXAMPLES = '''
|
||||
|
||||
'''
|
||||
|
||||
from ansible.module_utils.basic import *
|
||||
from ansible.module_utils.pycompat24 import get_exception
|
||||
|
||||
def main():
|
||||
module = AnsibleModule(
|
||||
argument_spec = dict(
|
||||
@@ -110,7 +113,8 @@ def main():
|
||||
|
||||
try:
|
||||
rc, out, err = module.run_command(cmd)
|
||||
except Exception, e:
|
||||
except Exception:
|
||||
e = get_exception
|
||||
module.fail_json(msg=str(e))
|
||||
|
||||
msg = "Unexpected failure!"
|
||||
@@ -136,8 +140,6 @@ def main():
|
||||
|
||||
module.fail_json(msg=msg)
|
||||
|
||||
# import module snippets
|
||||
from ansible.module_utils.basic import *
|
||||
|
||||
main()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user