From f83b0fe2ee8be9226a52781ffa872929f88354c7 Mon Sep 17 00:00:00 2001 From: Bill Wei Date: Mon, 6 Aug 2018 15:06:24 -0400 Subject: [PATCH] ServiceAnsibleTower to provision both job and workflow --- app/models/service_ansible_tower.rb | 3 ++- spec/models/service_ansible_tower_spec.rb | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/app/models/service_ansible_tower.rb b/app/models/service_ansible_tower.rb index 3c44a5201d5..6a0ea1b1f4d 100644 --- a/app/models/service_ansible_tower.rb +++ b/app/models/service_ansible_tower.rb @@ -8,7 +8,8 @@ class ServiceAnsibleTower < Service alias_method :job_options=, :stack_options= def launch_job - @job = ManageIQ::Providers::AnsibleTower::AutomationManager::Job.create_job(job_template, job_options) + job_class = "#{job_template.class.parent.name}::#{job_template.class.stack_type}".constantize + @job = job_class.create_job(job_template, job_options) add_resource(@job) @job ensure diff --git a/spec/models/service_ansible_tower_spec.rb b/spec/models/service_ansible_tower_spec.rb index a1fa759888d..13187557d6a 100644 --- a/spec/models/service_ansible_tower_spec.rb +++ b/spec/models/service_ansible_tower_spec.rb @@ -1,7 +1,7 @@ describe ServiceAnsibleTower do let(:tower) { FactoryGirl.create(:automation_manager_ansible_tower) } - let(:template_by_dialog) { FactoryGirl.create(:configuration_script, :manager => tower) } - let(:template_by_setter) { FactoryGirl.create(:configuration_script, :manager => tower) } + let(:template_by_dialog) { FactoryGirl.create(:ansible_configuration_script, :manager => tower) } + let(:template_by_setter) { FactoryGirl.create(:ansible_configuration_script, :manager => tower) } let(:dialog_options) do {