From adc5ea51686943d05b9648f1ce71ec7059146b46 Mon Sep 17 00:00:00 2001 From: Toshio Kuratomi Date: Wed, 25 May 2016 11:56:51 -0700 Subject: [PATCH] Fix exception catching for python3 --- .../extras/monitoring/honeybadger_deployment.py | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/lib/ansible/modules/extras/monitoring/honeybadger_deployment.py b/lib/ansible/modules/extras/monitoring/honeybadger_deployment.py index 457daa981f..3a6d2df7c8 100644 --- a/lib/ansible/modules/extras/monitoring/honeybadger_deployment.py +++ b/lib/ansible/modules/extras/monitoring/honeybadger_deployment.py @@ -22,7 +22,7 @@ DOCUMENTATION = ''' --- module: honeybadger_deployment author: "Benjamin Curtis (@stympy)" -version_added: "2.1" +version_added: "2.2" short_description: Notify Honeybadger.io about app deployments description: - Notify Honeybadger.io about app deployments (see http://docs.honeybadger.io/article/188-deployment-tracking) @@ -78,6 +78,11 @@ RETURN = '''# ''' 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. # @@ -122,7 +127,8 @@ def main(): try: data = urllib.urlencode(params) 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) else: if info['status'] == 200: @@ -130,10 +136,6 @@ def main(): else: 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__': main()