-
Notifications
You must be signed in to change notification settings - Fork 14
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
Tag-based stack start/stop #68
base: master
Are you sure you want to change the base?
Tag-based stack start/stop #68
Conversation
CfnManage::CloudFormation::EnvironmentRunStop.new().stop_environment($options['STACK_NAME'], 'stack') | ||
elsif $options['STACK_TAG'] | ||
CfnManage::CloudFormation::EnvironmentRunStop.new().stop_environment($options['STACK_TAG'], 'tag') | ||
end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
show the user an error if either STACK_NAME
or STACK_TAG
isn't supplied
CfnManage::CloudFormation::EnvironmentRunStop.new().start_environment($options['STACK_NAME'], 'stack') | ||
elsif $options['STACK_TAG'] | ||
CfnManage::CloudFormation::EnvironmentRunStop.new().start_environment($options['STACK_TAG'], 'tag') | ||
end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
show the user an error if either STACK_NAME or STACK_TAG isn't supplied
elsif arg_type == 'stack' | ||
stacks.push(arg) | ||
end | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
throw an error if no stacks are found
|
||
tag_key = tag.split('=')[0] | ||
tag_value = tag.split('=')[1] | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
handle --stack-tag input if format is not equal to key=value
and return error to user
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
few comments/suggestions. Likely being a little fussy
|
||
lookup_results = [] | ||
|
||
tag_key = tag.split('=')[0] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
possibly being pedantic but could you simplify to
tag_key, tag_value = tag.split('=')
Unless you're expecting more than two elements?
tag_value = tag.split('=')[1] | ||
|
||
cf_resource = Aws::CloudFormation::Resource.new() | ||
stack_collection = cf_resource.stacks.each { |stack| |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why assign the loop to a variable?
cf_resource = Aws::CloudFormation::Resource.new() | ||
stack_collection = cf_resource.stacks.each { |stack| | ||
next if !stack.root_id.nil? | ||
stack.tags.each { |tag| |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
could you use .select here instead of .each
No description provided.