diff --git a/app/controllers/miq_ae_tools_controller.rb b/app/controllers/miq_ae_tools_controller.rb index 6e941924fef..311d6746445 100644 --- a/app/controllers/miq_ae_tools_controller.rb +++ b/app/controllers/miq_ae_tools_controller.rb @@ -215,19 +215,7 @@ def retrieve_git_datastore git_repo_id = setup_results[:git_repo_id] new_git_repo = setup_results[:new_git_repo?] - task_options = { - :action => "Retrieve git repository", - :userid => current_user.userid - } - queue_options = { - :class_name => "GitRepository", - :method_name => "refresh", - :instance_id => git_repo_id, - :role => "git_owner", - :args => [] - } - - task_id = MiqTask.generic_action_with_callback(task_options, queue_options) + task_id = git_based_domain_import_service.queue_refresh(git_repo_id) response_json = {:task_id => task_id, :git_repo_id => git_repo_id, :new_git_repo => new_git_repo} rescue => err add_flash(_("Error during repository setup: %{error_message}") % {:error_message => err.message}, :error) diff --git a/spec/controllers/miq_ae_tools_controller_spec.rb b/spec/controllers/miq_ae_tools_controller_spec.rb index e8ed54c456b..ae8fd6742b0 100644 --- a/spec/controllers/miq_ae_tools_controller_spec.rb +++ b/spec/controllers/miq_ae_tools_controller_spec.rb @@ -326,16 +326,7 @@ context "when everything works fine" do let(:git_repo) { double("GitRepository", :id => 123) } - let(:task_options) { {:action => "Retrieve git repository", :userid => controller.current_user.userid} } - let(:queue_options) do - { - :class_name => "GitRepository", - :method_name => "refresh", - :instance_id => 123, - :role => "git_owner", - :args => [] - } - end + let(:git_based_domain_import_service) { double("GitBasedDomainImportService") } before do allow(git_repository_service).to receive(:setup).with( @@ -344,7 +335,8 @@ "gitpassword", "gitverifyssl" ).and_return({:git_repo_id => git_repo.id, :new_git_repo? => false}) - allow(MiqTask).to receive(:generic_action_with_callback).with(task_options, queue_options).and_return(321) + allow(GitBasedDomainImportService).to receive(:new).and_return(git_based_domain_import_service) + allow(git_based_domain_import_service).to receive(:queue_refresh).with(123).and_return(321) end it "responds with task information" do