Don't call sys.exit in sns_topic, use HAS_BOTO to fail

This commit is contained in:
Matt Martz 2016-03-01 14:22:28 -06:00 committed by Matt Clay
parent 27be34ef9d
commit 402a996430
2 changed files with 6 additions and 3 deletions

View file

@ -134,9 +134,9 @@ import re
try:
import boto
import boto.sns
HAS_BOTO = True
except ImportError:
print "failed=True msg='boto required for this module'"
sys.exit(1)
HAS_BOTO = False
def canonicalize_endpoint(protocol, endpoint):
@ -186,6 +186,9 @@ def main():
module = AnsibleModule(argument_spec=argument_spec, supports_check_mode=True)
if not HAS_BOTO:
module.fail_json(msg='boto required for this module')
name = module.params.get('name')
state = module.params.get('state')
display_name = module.params.get('display_name')