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

32 lines
844 B
Ruby
Raw Permalink Normal View History

2015-11-03 11:46:54 +03:00
require 'db/mongo/models/stack/stack_base'
2015-03-06 12:20:30 +03:00
module Devops
module Model
2018-04-04 22:44:39 +03:00
class StackAws < StackBase
2015-08-04 12:40:08 +03:00
2016-02-24 21:26:44 +03:00
def initialize attrs={}
super
2018-04-04 22:44:39 +03:00
self.provider = 'aws'
2015-08-04 12:40:08 +03:00
end
def update_in_cloud!(params)
parameters = params.keep_if do |key|
2018-04-04 22:44:39 +03:00
%w(Parameters 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
2018-04-04 22:44:39 +03:00
update_in_cloud!('TemplateUrl' => stack_template_model.template_url)
save
end
2015-03-06 12:20:30 +03:00
end
end
2015-02-12 13:01:05 +03:00
end