some fixes
This commit is contained in:
parent
78d10b6cbf
commit
b622919bcf
@ -13,6 +13,7 @@ module StackCommands
|
||||
sleep_times.each do |sleep_time|
|
||||
sleep sleep_time
|
||||
stack.sync_details!
|
||||
puts stack.stack_status
|
||||
if stack.stack_status != 'CREATE_IN_PROGRESS'
|
||||
mongo.stack_update(stack)
|
||||
out << "Stack '#{stack.id}' status is now #{stack.stack_status}"
|
||||
|
||||
@ -59,7 +59,7 @@ module Devops
|
||||
end
|
||||
|
||||
def sync_details!
|
||||
self.details = provider_instance.stack_details(self).attributes
|
||||
self.details = provider_instance.stack_details(self)#.attributes
|
||||
end
|
||||
|
||||
def resources
|
||||
|
||||
@ -7,6 +7,10 @@ module Devops
|
||||
super(attr)
|
||||
end
|
||||
|
||||
def stack_status
|
||||
details['StackStatus'] if details
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@ -235,15 +235,16 @@ module Provider
|
||||
end
|
||||
|
||||
def delete_stack(stack)
|
||||
fog_stack(stack).destroy
|
||||
cloud_formation.delete_stack(stack.name)
|
||||
end
|
||||
|
||||
def stack_details(stack)
|
||||
fog_stack(stack).details
|
||||
d = cloud_formation.describe_stacks({'StackName' => stack.name}).body['Stacks'][0]['stack']
|
||||
puts "Details: #{d.inspect}"
|
||||
end
|
||||
|
||||
def stack_resources(stack)
|
||||
fog_stack(stack).resources
|
||||
cloud_formation.describe_stack_resources({'StackName' => stack.name}).body['StackResources']
|
||||
end
|
||||
|
||||
def stack_resource(stack, resource_id)
|
||||
@ -252,7 +253,7 @@ module Provider
|
||||
end
|
||||
|
||||
def stack_servers(stack)
|
||||
fog_stack(stack).resources.map{|r| compute.servers.get(r.physical_resource_id)}
|
||||
stack_resources(stack).map{|r| compute.servers.get(r.physical_resource_id)}
|
||||
end
|
||||
|
||||
private
|
||||
@ -306,8 +307,5 @@ module Provider
|
||||
r
|
||||
end
|
||||
|
||||
def fog_stack(stack)
|
||||
cloud_formation.stacks.get(stack.name, stack.id)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@ -200,12 +200,14 @@ module Provider
|
||||
out << "Stack template: #{stack.stack_template}\n"
|
||||
out << "Stack parameters: #{stack.parameters}\n"
|
||||
out << "Stack template: #{stack.template_body}\n"
|
||||
out.flush
|
||||
response = orchestration.create_stack(
|
||||
stack_name: stack.name,
|
||||
template: stack.template_body,
|
||||
parameters: stack.parameters || {}
|
||||
)
|
||||
stack.id = response[:body]['stack']['id']
|
||||
out << "Stack id: #{stack.id}\n"
|
||||
rescue Excon::Errors::Conflict => e
|
||||
raise ProviderErrors::NameConflict
|
||||
rescue Excon::Errors::BadRequest => br
|
||||
@ -223,15 +225,15 @@ module Provider
|
||||
end
|
||||
|
||||
def delete_stack(stack)
|
||||
fog_stack(stack).destroy
|
||||
orchestration.delete_stack(Fog::Orchestration::OpenStack::Stack.new({'id' => stack.id, 'stack_name' => stack.name}))
|
||||
end
|
||||
|
||||
def stack_details(stack)
|
||||
fog_stack(stack).details
|
||||
orchestration.show_stack_details(stack.name, stack.id).body['stack']
|
||||
end
|
||||
|
||||
def stack_resources(stack)
|
||||
fog_stack(stack).resources
|
||||
orchestration.list_resources(Fog::Orchestration::OpenStack::Stack.new({'id' => stack.id, 'stack_name' => stack.name})).body['resources']
|
||||
end
|
||||
|
||||
def stack_resource(stack, resource_id)
|
||||
@ -240,7 +242,7 @@ module Provider
|
||||
end
|
||||
|
||||
def stack_servers(stack)
|
||||
fog_stack(stack).resources.map{|r| compute.servers.get(r.physical_resource_id)}
|
||||
stack_resources(stack).map{|r| compute.servers.get(r['physical_resource_id'])}
|
||||
end
|
||||
|
||||
private
|
||||
@ -268,9 +270,5 @@ module Provider
|
||||
@connection ||= Fog::Orchestration.new(connection_options)
|
||||
end
|
||||
|
||||
def fog_stack(stack)
|
||||
orchestration.stacks.get(stack.name, stack.id)
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
Loading…
Reference in New Issue
Block a user