[cloud] Remove repeated error handling and region checking, both now in boto3_conn (#32774)

* Remove boto usage from boto3 modules

* Remove region checking

boto3_conn now takes care of region checking and handles NoRegionError
exceptions with a standard message

boto3_conn also takes care of other connection exceptions too.

* Document boto3 as a requirement for ec2_eni_facts
This commit is contained in:
Will Thames 2017-12-15 07:16:59 +10:00 committed by Ryan Brown
parent c52964a6f4
commit ddc3465408
8 changed files with 37 additions and 173 deletions

View file

@ -218,13 +218,9 @@ class EFSConnection(object):
STATE_DELETED = 'deleted'
def __init__(self, module, region, **aws_connect_params):
try:
self.connection = boto3_conn(module, conn_type='client',
resource='efs', region=region,
**aws_connect_params)
except Exception as e:
module.fail_json(msg="Failed to connect to AWS: %s" % str(e))
self.connection = boto3_conn(module, conn_type='client',
resource='efs', region=region,
**aws_connect_params)
self.region = region
self.wait = module.params.get('wait')
self.wait_timeout = module.params.get('wait_timeout')
@ -490,7 +486,7 @@ class EFSConnection(object):
def iterate_all(attr, map_method, **kwargs):
"""
Method creates iterator from boto result set
Method creates iterator from result set
"""
args = dict((key, value) for (key, value) in kwargs.items() if value is not None)
wait = 1