Skip to content

Commit

Permalink
Add service object to deliver to automate.
Browse files Browse the repository at this point in the history
The generic service state machine uses the service object.
We're currently getting the service object from the task which causes a
problem in retirement because we don't have a task.
  • Loading branch information
tinaafitz committed Feb 16, 2017
1 parent 977f8ef commit 8cd6d8f
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 2 additions & 0 deletions app/models/service_template_provision_task.rb
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,8 @@ def deliver_to_automate(req_type = request_type, _zone = nil)
args[:automate_message] = ra.ae_message unless ra.ae_message.blank?
args[:attrs].merge!(ra.ae_attributes)
end

args[:attrs].merge!(MiqAeEngine.create_automation_attributes(destination.class.base_model.name => destination))
args[:user_id] = get_user.id
args[:miq_group_id] = get_user.current_group.id
args[:tenant_id] = get_user.current_tenant.id
Expand Down
4 changes: 3 additions & 1 deletion spec/models/service_template_provision_task_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,8 @@ def service_resource_id(index, scaling_max)

describe "#deliver_to_automate" do
it "delivers to the queue when the state is not active" do
@service = FactoryGirl.create(:service, :name => 'Test Service')
@task_0.destination = @service
@task_0.state = 'pending'
zone = FactoryGirl.create(:zone, :name => "special")
orchestration_manager = FactoryGirl.create(:ext_management_system, :zone => zone)
Expand All @@ -86,7 +88,7 @@ def service_resource_id(index, scaling_max)
:class_name => 'ServiceProvision_Template',
:instance_name => 'clone_to_service',
:automate_message => 'create',
:attrs => {'request' => 'clone_to_service'},
:attrs => {'request' => 'clone_to_service', 'Service::Service' => @service.id},
:user_id => @admin.id,
:miq_group_id => @admin.current_group_id,
:tenant_id => @admin.current_tenant.id,
Expand Down

0 comments on commit 8cd6d8f

Please sign in to comment.