fluke/devops-service/db/mongo/models/stack/stack_ec2.rb
2016-02-24 21:26:44 +03:00

32 lines
873 B
Ruby

require 'db/mongo/models/stack/stack_base'
module Devops
module Model
class StackEc2 < StackBase
def initialize attrs={}
super
self.provider = 'ec2'
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
end
end
end