1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

Fix exception catching for python3

This commit is contained in:
Toshio Kuratomi 2016-05-25 11:56:51 -07:00 committed by Matt Clay
parent 778bffe35c
commit adc5ea5168

View file

@ -22,7 +22,7 @@ DOCUMENTATION = '''
--- ---
module: honeybadger_deployment module: honeybadger_deployment
author: "Benjamin Curtis (@stympy)" author: "Benjamin Curtis (@stympy)"
version_added: "2.1" version_added: "2.2"
short_description: Notify Honeybadger.io about app deployments short_description: Notify Honeybadger.io about app deployments
description: description:
- Notify Honeybadger.io about app deployments (see http://docs.honeybadger.io/article/188-deployment-tracking) - Notify Honeybadger.io about app deployments (see http://docs.honeybadger.io/article/188-deployment-tracking)
@ -78,6 +78,11 @@ RETURN = '''# '''
import urllib import urllib
# import module snippets
from ansible.module_utils.basic import *
from ansible.module_utils.pycompat24 import get_exception
from ansible.module_utils.urls import *
# =========================================== # ===========================================
# Module execution. # Module execution.
# #
@ -122,7 +127,8 @@ def main():
try: try:
data = urllib.urlencode(params) data = urllib.urlencode(params)
response, info = fetch_url(module, url, data=data) response, info = fetch_url(module, url, data=data)
except Exception, e: except Exception:
e = get_exception()
module.fail_json(msg='Unable to notify Honeybadger: %s' % e) module.fail_json(msg='Unable to notify Honeybadger: %s' % e)
else: else:
if info['status'] == 200: if info['status'] == 200:
@ -130,10 +136,6 @@ def main():
else: else:
module.fail_json(msg="HTTP result code: %d connecting to %s" % (info['status'], url)) module.fail_json(msg="HTTP result code: %d connecting to %s" % (info['status'], url))
# import module snippets
from ansible.module_utils.basic import *
from ansible.module_utils.urls import *
if __name__ == '__main__': if __name__ == '__main__':
main() main()