From fd18d7ebb52d09dddeb44d21ceeeb61d66aeb77c Mon Sep 17 00:00:00 2001 From: Will Thames Date: Thu, 14 Sep 2017 04:34:26 +1000 Subject: [PATCH] [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 --- lib/ansible/modules/cloud/amazon/elb_target_group_facts.py | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/lib/ansible/modules/cloud/amazon/elb_target_group_facts.py b/lib/ansible/modules/cloud/amazon/elb_target_group_facts.py index 77d5b37485..0cf548ea30 100644 --- a/lib/ansible/modules/cloud/amazon/elb_target_group_facts.py +++ b/lib/ansible/modules/cloud/amazon/elb_target_group_facts.py @@ -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):