fluke/devops-service/db/mongo/models/stack/stack_ec2.rb

41 lines
1.1 KiB
Ruby
Raw Normal View History

2015-03-06 12:20:30 +03:00
module Devops
module Model
class StackEc2 < StackBase
2015-08-04 12:40:08 +03:00
def initialize attr={}
self.provider = 'ec2'
super(attr)
end
2015-08-17 17:50:24 +03:00
def stack_status
self.details['StackStatus'] if self.details
2015-08-17 17:50:24 +03:00
end
2015-08-28 17:00:48 +03:00
def bson_safe_details
return unless details
result = details.dup
result['CreationTime'] = result['CreationTime'].to_s
result
end
def update_in_cloud!(params)
parameters = params.keep_if do |key|
%w(Parameters TemplateBody TemplateURL Capabilities).include?(key)
end
provider_instance.update_stack(self, parameters)
end
# We should improve this functionality: stack will be rollbacked
# if there are errors during stack_template changing, so we should track
# that process and persist changes only in case of success.
def change_stack_template!(stack_template)
self.stack_template = stack_template
update_in_cloud!('TemplateBody' => template_body)
Devops::Db.connector.stack_update(self)
end
2015-03-06 12:20:30 +03:00
end
end
2015-02-12 13:01:05 +03:00
end