lib/roark/ami_create_workflow.rb in roark-0.0.1 vs lib/roark/ami_create_workflow.rb in roark-0.1.0

- old
+ new

@@ -1,27 +1,28 @@ module Roark class AmiCreateWorkflow def initialize(args) - @ami = args[:ami] - @parameters = args[:parameters] - @template = args[:template] - @logger = Roark.logger + @account_ids = args[:account_ids] + @ami = args[:ami] + @parameters = args[:parameters] + @template = args[:template] + @logger = Roark.logger end def execute %w(create_instance wait_for_instance stop_instance wait_for_instance_to_stop - create_ami wait_for_ami destroy_instance).each do |m| + create_ami wait_for_ami destroy_instance authorize_account_ids).each do |m| response = self.send m.to_sym return response unless response.success? end Response.new :code => 0, :message => "AMI create workflow completed succesfully." end def create_instance @ami.create_instance :parameters => @parameters, - :template => @template + :template => @template end def wait_for_instance @ami.wait_for_instance end @@ -42,9 +43,13 @@ @ami.wait_for_ami end def destroy_instance @ami.destroy_instance + end + + def authorize_account_ids + @ami.authorize_account_ids @account_ids end end end