Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Backport/2.9/57737 ec2_asg unhandled exception #67431

Merged
merged 2 commits into from Mar 3, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 2 additions & 0 deletions changelogs/fragments/57737-fix-asg-with-no-lc-anymore.yml
@@ -0,0 +1,2 @@
bugfixes:
- ec2_asg - regression bug, when an existing autoscaling group was updated and but the launch config of existing instances was deleted.
4 changes: 2 additions & 2 deletions lib/ansible/modules/cloud/amazon/ec2_asg.py
Expand Up @@ -1382,7 +1382,7 @@ def get_instances_by_launch_config(props, lc_check, initial_instances):
# Check if migrating from launch_template to launch_config first
if 'launch_template' in props['instance_facts'][i]:
old_instances.append(i)
elif props['instance_facts'][i]['launch_config_name'] == props['launch_config_name']:
elif props['instance_facts'][i].get('launch_config_name') == props['launch_config_name']:
new_instances.append(i)
else:
old_instances.append(i)
Expand All @@ -1409,7 +1409,7 @@ def get_instances_by_launch_template(props, lt_check, initial_instances):
# Check if migrating from launch_config_name to launch_template_name first
if 'launch_config_name' in props['instance_facts'][i]:
old_instances.append(i)
elif props['instance_facts'][i]['launch_template'] == props['launch_template']:
elif props['instance_facts'][i].get('launch_template') == props['launch_template']:
new_instances.append(i)
else:
old_instances.append(i)
Expand Down