#891: create stack events

This commit is contained in:
amartynov 2015-11-17 13:23:13 +03:00
parent 27437914a1
commit 126caa2682
4 changed files with 11 additions and 1 deletions

View File

@ -24,6 +24,7 @@ module StackCommands
sleep_times.each do |sleep_time|
sleep sleep_time
stack.sync_details!
out.puts stack.events.inspect
case stack.stack_status
when 'CREATE_IN_PROGRESS'
out << "."

View File

@ -7,7 +7,7 @@ module Devops
include ModelWithProvider
attr_accessor :id, :name, :project, :deploy_env, :stack_template, :parameters, :details, :owner, :run_list
attr_accessor :id, :name, :project, :deploy_env, :stack_template, :parameters, :details, :events, :owner, :run_list
types id: {type: String, empty: false},
provider: {type: String, empty: false},
@ -67,6 +67,7 @@ module Devops
def sync_details!
self.details = provider_instance.stack_details(self)
self.events = provider_instance.stack_events(self)
end
def resources

View File

@ -43,5 +43,9 @@ module Provider
def set_stack_tags stack, out=""
end
def stack_events(stack)
[]
end
end
end

View File

@ -294,6 +294,10 @@ module Provider
cloud_formation.describe_stack_resources({'StackName' => stack.name}).body['StackResources']
end
def stack_events(stack)
cloud_formation.describe_stack_events(stack.name).body['StackEvents'].map{|se| {"stack_name" => se["StackName"], "stack_id" => se["StackId"], "event_id" => se["EventId"], "reason" => se["ResourceStatusReason"]}}
end
# не работает, не используется
# def stack_resource(stack, resource_id)
# physical_id = fog_stack(stack).resources.get(resource_id).physical_resource_id