1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

Format ELBInfo call (#22383)

Move declaration of AWSRetry of get_all_load_balancers so it isn't redeclared for every page of data.
This commit is contained in:
Ryan Brown 2017-03-13 15:45:18 -04:00 committed by Ryan S. Brown
parent 6d8edfc35f
commit 19511971ee

View file

@ -210,9 +210,9 @@ class ElbInformation(object):
def list_elbs(self):
elb_array, token = [], None
get_elb_with_backoff = AWSRetry.backoff(tries=5, delay=5, backoff=2.0)(self.connection.get_all_load_balancers)
while True:
all_elbs = AWSRetry.backoff(tries=5, delay=5, backoff=2.0)(self.connection.get_all_load_balancers)(marker=token)
all_elbs = get_elb_with_backoff(marker=token)
token = all_elbs.next_token
if all_elbs:
@ -244,17 +244,13 @@ def main():
module.fail_json(msg='boto required for this module')
try:
region, ec2_url, aws_connect_params = get_aws_connection_info(module)
if not region:
module.fail_json(msg="region must be specified")
names = module.params['names']
elb_information = ElbInformation(module,
names,
region,
**aws_connect_params)
elb_information = ElbInformation(
module, names, region, **aws_connect_params)
ec2_facts_result = dict(changed=False,
elbs=elb_information.list_elbs())