mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-04-25 20:01:25 -07:00
Fixed exceptions to use python 2.4 helper function and added import also works on python 3 (#2363)
This commit is contained in:
parent
25b79bafd2
commit
e30049d113
3 changed files with 25 additions and 13 deletions
|
@ -171,6 +171,10 @@ except ImportError:
|
|||
|
||||
import base64
|
||||
|
||||
from ansible.module_utils.basic import *
|
||||
from ansible.module_utils.urls import *
|
||||
from ansible.module_utils.pycompat24 import get_exception
|
||||
|
||||
def request(url, user, passwd, data=None, method=None):
|
||||
if data:
|
||||
data = json.dumps(data)
|
||||
|
@ -343,13 +347,13 @@ def main():
|
|||
|
||||
ret = method(restbase, user, passwd, module.params)
|
||||
|
||||
except Exception, e:
|
||||
except Exception:
|
||||
e = get_exception()
|
||||
return module.fail_json(msg=e.message)
|
||||
|
||||
|
||||
module.exit_json(changed=True, meta=ret)
|
||||
|
||||
|
||||
from ansible.module_utils.basic import *
|
||||
from ansible.module_utils.urls import *
|
||||
|
||||
main()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue