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

Fix for neither LaunchConfigName nor LaunchTemplate existing on object (#54692)

This commit is contained in:
Jason Witkowski 2019-04-08 19:00:51 -04:00 committed by Will Thames
parent 4b22240edd
commit 87f8e37c2c
2 changed files with 6 additions and 1 deletions

View file

@ -0,0 +1,2 @@
bugfixes:
- ec2_asg - Fix error where ASG dict has no launch config or launch template key

View file

@ -629,10 +629,13 @@ def get_properties(autoscaling_group):
instance_facts[i['InstanceId']] = {'health_status': i['HealthStatus'],
'lifecycle_state': i['LifecycleState'],
'launch_config_name': i['LaunchConfigurationName']}
else:
elif i.get('LaunchTemplate'):
instance_facts[i['InstanceId']] = {'health_status': i['HealthStatus'],
'lifecycle_state': i['LifecycleState'],
'launch_template': i['LaunchTemplate']}
else:
instance_facts[i['InstanceId']] = {'health_status': i['HealthStatus'],
'lifecycle_state': i['LifecycleState']}
if i['HealthStatus'] == 'Healthy' and i['LifecycleState'] == 'InService':
properties['viable_instances'] += 1
if i['HealthStatus'] == 'Healthy':