Skip to content

Commit

Permalink
Merged in dev/andre/power_stack_script_handle_ASG_nonexist_StackName_…
Browse files Browse the repository at this point in the history
…tag (pull request elastic#306)

improve power_stack script robustness

* improve robustness of script which was throwing KeyError for ASG that did not have StackName tag defined


Approved-by: fabien
  • Loading branch information
Andre Sodermans committed Nov 18, 2021
1 parent dc6f27b commit 8048372
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion aws/misc/stack_power.py
Expand Up @@ -105,7 +105,8 @@ def auto_scaling_group(args):
for group in res['AutoScalingGroups']:
# parse group's tags
tags = {tag['Key']: tag['Value'] for tag in group['Tags']}
if tags['StackName'] != args.stack_name:
stackName = tags.get('StackName')
if not stackName or stackName != args.stack_name:
print('Skipping ASG', group['AutoScalingGroupName'])
continue
if args.power_on:
Expand Down

0 comments on commit 8048372

Please sign in to comment.