class Object
Constants
- VERSION
Public Instance Methods
event_color(resource_status)
click to toggle source
# File bin/tailstack, line 117 def event_color(resource_status) event_green = %w[ UPDATE_COMPLETE CREATE_COMPLETE DELETE_COMPLETE UPDATE_COMPLETE_CLEANUP_IN_PROGRESS UPDATE_ROLLBACK_COMPLETE ] event_yellow = %w[ UPDATE_IN_PROGRESS CREATE_IN_PROGRESS DELETE_IN_PROGRESS UPDATE_ROLLBACK_IN_PROGRESS UPDATE_ROLLBACK_COMPLETE_CLEANUP_IN_PROGRESS ] case when event_green.include?(resource_status) return resource_status.green when event_yellow.include?(resource_status) return resource_status.brown else return resource_status.red end end
isThisTheEnd?(event)
click to toggle source
# File bin/tailstack, line 134 def isThisTheEnd? event events_good = %w[ CREATE_COMPLETE UPDATE_COMPLETE DELETE_COMPLETE ] events_bad = %w[ CREATE_FAILED UPDATE_ROLLBACK_COMPLETE ROLLBACK_COMPLETE UPDATE_ROLLBACK_FAILED ] return false unless event[:resource_type] == 'AWS::CloudFormation::Stack' exit 1 if events_bad.include? event[:resource_status] return events_good.include? event[:resource_status] end
print_list(cfn, options)
click to toggle source
# File bin/tailstack, line 143 def print_list(cfn, options) # Build up map that contains the stack id -> status status_map = {} cfn.list_stacks.to_h[:stack_summaries].each do |s| status_map[s[:stack_id]] = s[:stack_status] end stacks = [] next_token = nil loop do resp = cfn.describe_stacks({next_token: next_token}).to_h stacks += resp[:stacks] break unless resp[:next_token] next_token = resp[:next_token] end stacks.each do |s| next if options.key?(:stack) && options[:stack] != s[:stack_name] next if status_map[s[:stack_id]] == 'DELETE_COMPLETE' puts "#{s[:stack_name].bold} - #{s[:description].cyan}" unless options.key? :get_out if options.key?(:parms) && s[:parameters] puts " #{"Parameters:".green}" s[:parameters].each do |parm| puts " #{parm[:parameter_key].blue}: #{parm[:parameter_value].gray}" end end if (options.key?(:outputs) || options.key?(:get_out)) && s[:outputs] puts " #{"Outputs:".magenta}" unless options.key? :get_out s[:outputs].each do |output| if options.key?(:get_out) && output[:output_key] == options[:get_out] puts output[:output_value] exit 0 end puts " #{output[:output_key].brown}: #{output[:output_value].gray}" unless options.key? :get_out end end end exit 0 end