cope with an ASG instance not having a launch config any more (#57737)

This commit is contained in:
Andrew de Quincey 2020-02-12 10:54:58 +00:00 committed by GitHub
parent 8ac0bbcbf6
commit d1846b96c0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1497,7 +1497,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)
@ -1524,7 +1524,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)