diff --git a/lib/ansible/modules/extras/notification/mqtt.py b/lib/ansible/modules/extras/notification/mqtt.py index efc54423aa..f68ac3ea6e 100644 --- a/lib/ansible/modules/extras/notification/mqtt.py +++ b/lib/ansible/modules/extras/notification/mqtt.py @@ -156,11 +156,13 @@ def main(): hostname=server, port=port, auth=auth) - except Exception, e: + except Exception: + e = get_exception() module.fail_json(msg="unable to publish to MQTT broker %s" % (e)) module.exit_json(changed=False, topic=topic) # import module snippets from ansible.module_utils.basic import * +from ansible.module_utils.pycompat24 import get_exception main() diff --git a/lib/ansible/modules/extras/test/utils/shippable/sanity-skip-python3.txt b/lib/ansible/modules/extras/test/utils/shippable/sanity-skip-python3.txt index 2674bf0584..bfeeff7874 100644 --- a/lib/ansible/modules/extras/test/utils/shippable/sanity-skip-python3.txt +++ b/lib/ansible/modules/extras/test/utils/shippable/sanity-skip-python3.txt @@ -66,4 +66,3 @@ /network/openvswitch_port.py /notification/jabber.py /notification/mail.py -/notification/mqtt.py