Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Passes result_format when automate workspace is not expected #19407

Merged
merged 1 commit into from
Oct 23, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions app/models/custom_button.rb
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ def applies_to=(other)
end

def invoke(target, source = nil)
args = resource_action.automate_queue_hash(target, {}, User.current_user)
args = resource_action.automate_queue_hash(target, {"result_format" => 'ignore'}, User.current_user)

publish_event(source, target, args)
MiqQueue.put(queue_opts(target, args))
Expand Down Expand Up @@ -142,7 +142,7 @@ def invoke_async(target, source = nil)
:userid => User.current_user
}

args = resource_action.automate_queue_hash(target, {}, User.current_user)
args = resource_action.automate_queue_hash(target, {"result_format" => 'ignore'}, User.current_user)

publish_event(source, target, args)
MiqTask.generic_action_with_callback(task_opts, queue_opts(target, args))
Expand Down
1 change: 0 additions & 1 deletion app/models/resource_action.rb
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ def automate_queue_hash(target, override_attrs, user, open_url_task_id = nil)
end

attrs = (ae_attributes || {}).merge(override_attrs || {})
attrs["result_format"] = 'ignore'

{
:namespace => ae_namespace,
Expand Down
10 changes: 7 additions & 3 deletions spec/models/resource_action_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
let(:zone_name) { "default" }
let(:ra) { FactoryBot.create(:resource_action) }
let(:miq_server) { FactoryBot.create(:miq_server) }
let(:ae_attributes) { { "result_format" => "ignore"} }
let(:ae_attributes) { {} }
let(:q_args) do
{
:namespace => nil,
Expand Down Expand Up @@ -114,8 +114,12 @@
let(:user) { FactoryBot.create(:user_with_group) }
let(:target) { FactoryBot.create(:vm_vmware) }

it "adds result_format" do
expect(ra.automate_queue_hash(target, {}, user)).to include(:attrs => {"result_format"=>"ignore"})
it "passes result_format" do
expect(ra.automate_queue_hash(target, {"result_format"=>"ignore"}, user)).to include(:attrs => {"result_format"=>"ignore"})
end

it "does not pass result_format by default" do
expect(ra.automate_queue_hash(target, {}, user)).not_to include(:attrs => {"result_format"=>"ignore"})
end
end
end