From e710e46ff23822b54a1051b938cd4186063cc92a Mon Sep 17 00:00:00 2001 From: Toshio Kuratomi Date: Thu, 26 Mar 2015 12:12:09 -0700 Subject: [PATCH] Make lack of boto call fail_json instead of sys.exit Fixes #994 --- lib/ansible/modules/cloud/amazon/cloudformation.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/ansible/modules/cloud/amazon/cloudformation.py b/lib/ansible/modules/cloud/amazon/cloudformation.py index 6963fb6f1d..44121a5c6d 100644 --- a/lib/ansible/modules/cloud/amazon/cloudformation.py +++ b/lib/ansible/modules/cloud/amazon/cloudformation.py @@ -125,9 +125,9 @@ import time try: import boto import boto.cloudformation.connection + HAS_BOTO = True except ImportError: - print "failed=True msg='boto required for this module'" - sys.exit(1) + HAS_BOTO = False def boto_exception(err): @@ -219,6 +219,8 @@ def main(): module = AnsibleModule( argument_spec=argument_spec, ) + if not HAS_BOTO: + module.fail_json(msg='boto required for this module') state = module.params['state'] stack_name = module.params['stack_name']