Skip to content

Commit

Permalink
Merge pull request #170 from Skarlso/169_dbcluster_tag_fix
Browse files Browse the repository at this point in the history
Tag Update fixed and made list aware of old stages. #169
  • Loading branch information
askreet committed Nov 18, 2016
2 parents 1ec2dfc + 75910a9 commit 9fab0f5
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
3 changes: 1 addition & 2 deletions lib/moonshot/stack.rb
Original file line number Diff line number Diff line change
Expand Up @@ -239,8 +239,7 @@ def update_stack
stack_name: @name,
template_body: template.body,
capabilities: ['CAPABILITY_IAM'],
parameters: @config.parameters.values.map(&:to_cf),
tags: make_tags
parameters: @config.parameters.values.map(&:to_cf)
)
true
rescue Aws::CloudFormation::Errors::ValidationError => e
Expand Down
12 changes: 9 additions & 3 deletions lib/moonshot/stack_lister.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ def initialize(app_name)
@app_name = app_name
end

# rubocop:disable Metrics/AbcSize
def list
result = []
next_token = nil
Expand All @@ -16,10 +17,15 @@ def list
resp.stacks.each do |stack|
app_tag = stack.tags.find { |t| t.key == 'moonshot_application' }
env_tag = stack.tags.find { |t| t.key == 'moonshot_environment' }
legacy_tag = stack.tags.find { |t| t.key == 'ah_stage' }

next unless app_tag && app_tag.value == Moonshot.config.app_name
result <<
EnvironmentDescription.new(env_tag.value, stack.creation_time, stack.stack_status)
if app_tag && app_tag.value == Moonshot.config.app_name
result <<
EnvironmentDescription.new(env_tag.value, stack.creation_time, stack.stack_status)
elsif legacy_tag && legacy_tag.value.start_with?(Moonshot.config.app_name)
result <<
EnvironmentDescription.new(legacy_tag.value, stack.creation_time, stack.stack_status)
end
end
break unless resp.next_token
next_token = resp.next_token
Expand Down

0 comments on commit 9fab0f5

Please sign in to comment.