mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-05-08 06:12:51 +00:00
Fixed modules/system py files for 2.4 to 3.5 exceptions (#2367)
This commit is contained in:
@@ -135,6 +135,8 @@ EXAMPLES = """
|
||||
import shutil
|
||||
import time
|
||||
import socket
|
||||
from ansible.module_utils.pycompat24 import get_exception
|
||||
from ansible.module_utils.basic import *
|
||||
|
||||
glusterbin = ''
|
||||
|
||||
@@ -147,7 +149,8 @@ def run_gluster(gargs, **kwargs):
|
||||
rc, out, err = module.run_command(args, **kwargs)
|
||||
if rc != 0:
|
||||
module.fail_json(msg='error running gluster (%s) command (rc=%d): %s' % (' '.join(args), rc, out or err))
|
||||
except Exception, e:
|
||||
except Exception:
|
||||
e = get_exception
|
||||
module.fail_json(msg='error running gluster (%s) command: %s' % (' '.join(args), str(e)))
|
||||
return out
|
||||
|
||||
@@ -456,6 +459,4 @@ def main():
|
||||
|
||||
module.exit_json(changed=changed, ansible_facts=facts)
|
||||
|
||||
# import module snippets
|
||||
from ansible.module_utils.basic import *
|
||||
main()
|
||||
|
||||
Reference in New Issue
Block a user