Class: Mstacks
- Inherits:
-
Object
- Object
- Mstacks
- Defined in:
- lib/mstacks.rb
Instance Method Summary collapse
- #active_mstacks ⇒ Object
- #autoupdate_stack_configs(environment_type) ⇒ Object
- #get_active_stack_summaries ⇒ Object
- #obsolete_statuses ⇒ Object
- #parse_stack_identity(name) ⇒ Object
- #stack_hub_url(stack_info) ⇒ Object
- #statuses ⇒ Object
Instance Method Details
#active_mstacks ⇒ Object
5 6 7 8 9 10 11 12 13 14 15 |
# File 'lib/mstacks.rb', line 5 def active_mstacks() a = [] get_active_stack_summaries.each do |summary| stack_identity = parse_stack_identity(summary[:stack_name]) if stack_identity stack_info = stack_identity.merge(summary) a.push(stack_info) end end return a end |
#autoupdate_stack_configs(environment_type) ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/mstacks.rb', line 17 def autoupdate_stack_configs(environment_type) yr = Ploy::YamlReader.new conf = yr.from_http("http://stack-hub/api/configured-stacks?EnvironmentType=#{environment_type}") configs = [] conf.each do |name, conf| if conf['stack_autoupdate'] configs.push(conf) end end return configs end |
#get_active_stack_summaries ⇒ Object
48 49 50 51 |
# File 'lib/mstacks.rb', line 48 def get_active_stack_summaries() cfn = AWS::CloudFormation.new return cfn.stack_summaries.with_status(statuses.to_a) end |
#obsolete_statuses ⇒ Object
71 72 73 74 75 76 77 |
# File 'lib/mstacks.rb', line 71 def obsolete_statuses() return Set.new [ :delete_in_progress, :delete_complete, :create_failed ] end |
#parse_stack_identity(name) ⇒ Object
35 36 37 38 39 40 41 42 43 44 45 46 |
# File 'lib/mstacks.rb', line 35 def parse_stack_identity(name) p = name.split("--") if not p.length == 3 return nil end return { :stack_name => name, :stack_type => p[0], :env_name => p[1], :env_type => p[2] } end |
#stack_hub_url(stack_info) ⇒ Object
30 31 32 33 |
# File 'lib/mstacks.rb', line 30 def stack_hub_url(stack_info) stack_name = stack_info.has_key?(:stack_name) ? stack_info[:stack_name] : stack_info['StackName'] return "http://stack-hub/api/#{stack_name}" end |
#statuses ⇒ Object
53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 |
# File 'lib/mstacks.rb', line 53 def statuses() return Set.new [ :create_in_progress, :create_complete, :rollback_in_progress, :rollback_failed, :rollback_complete, :delete_failed, :update_in_progress, :update_complete_cleanup_in_progress, :update_complete, :update_rollback_in_progress, :update_rollback_failed, :update_rollback_complete_cleanup_in_progress, :update_rollback_complete ] end |