From 89d3b8a7d6905f78cdc68df74e84e1b8118e8b24 Mon Sep 17 00:00:00 2001 From: Nick LaMuro Date: Tue, 8 Dec 2020 17:36:42 -0600 Subject: [PATCH] [EmbeddedAnsible::CrudCommon] Fix manager validation Putting this back as this was used in the specs to validate the correct manager was being used in the credential_spec.rb for `EmbeddedAnsible`: it ".create_in_provider_queue will fail with incompatible manager" do wrong_manager = FactoryBot.create(:configuration_manager_foreman) expect { credential_class.create_in_provider_queue(wrong_manager.id, params) }.to raise_error(ActiveRecord::RecordNotFound) end While there may be a better way of doing this, deleting the spec seems like the wrong way to fix this issue, and this was originally removed because it was assumed it wasn't needed. --- app/models/manageiq/providers/embedded_ansible/crud_common.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/app/models/manageiq/providers/embedded_ansible/crud_common.rb b/app/models/manageiq/providers/embedded_ansible/crud_common.rb index 2b684a1494b..376d178c4be 100644 --- a/app/models/manageiq/providers/embedded_ansible/crud_common.rb +++ b/app/models/manageiq/providers/embedded_ansible/crud_common.rb @@ -50,6 +50,7 @@ def encrypt_queue_params(params) end def create_in_provider_queue(manager_id, params, auth_user = nil) + parent.find(manager_id) # validation that the manager ID is from EmbeddedAnsible action = "Creating #{self::FRIENDLY_NAME}" action << " (name=#{params[:name]})" if params[:name] queue(nil, "create_in_provider", [manager_id, encrypt_queue_params(params)], action, auth_user)