issue #994: use HAS_BOTO to determine if import was successful: - removed import of sys module. - HAS_BOTO constant to check if import was successful. - trigger a failure when import fails. - removed unnecessary imports.

This commit is contained in:
steenzout 2015-04-01 17:16:54 -06:00 committed by Matt Clay
parent 0a48d54c1c
commit 67f769d9a6
21 changed files with 121 additions and 74 deletions

View file

@ -159,7 +159,6 @@ EXAMPLES = '''
'''
import sys
import time
try:
@ -167,9 +166,10 @@ try:
from boto import route53
from boto.route53 import Route53Connection
from boto.route53.record import ResourceRecordSets
HAS_BOTO = True
except ImportError:
print "failed=True msg='boto required for this module'"
sys.exit(1)
HAS_BOTO = False
def commit(changes, retry_interval):
"""Commit changes, but retry PriorRequestNotComplete errors."""
@ -203,6 +203,9 @@ def main():
)
module = AnsibleModule(argument_spec=argument_spec)
if not HAS_BOTO:
module.fail_json(msg='boto required for this module')
command_in = module.params.get('command')
zone_in = module.params.get('zone').lower()
ttl_in = module.params.get('ttl')