[cloud] Don't alter dictionary during iteration in elb_target_group_facts, avoiding RuntimeError (#30247)

Don't update the target_group_attributes dict
while iterating over it.

Fixes #30190
This commit is contained in:
Will Thames 2017-09-14 04:34:26 +10:00 committed by Ryan Brown
parent ba6d592039
commit fd18d7ebb5

View file

@ -184,11 +184,8 @@ def get_target_group_attributes(connection, module, target_group_arn):
module.fail_json(msg=e.message, exception=traceback.format_exc(), **camel_dict_to_snake_dict(e.response))
# Replace '.' with '_' in attribute key names to make it more Ansibley
for k, v in target_group_attributes.items():
target_group_attributes[k.replace('.', '_')] = v
del target_group_attributes[k]
return target_group_attributes
return dict((k.replace('.', '_'), v)
for (k, v) in target_group_attributes.items())
def get_target_group_tags(connection, module, target_group_arn):