Description of problem: When creating authentications using /api/authentications the provider type is not checked. The request fails with "undefined method `id' for nil:NilClass" when the manager_resource doesn't correspond to the "type". Version-Release number of selected component (if applicable): 5.8.1.5 How reproducible: very Steps to Reproduce: 1. POST /api/authentications { "description" : "Authentication Description", "name" : "SomeCredentials", "related" : {}, "type" : "ManageIQ::Providers::AnsibleTower::AutomationManager::Credential", "manager_resource" : { "href" : "https://<address>/api/providers/:id_of_existing_non_ansible_provider" } } 2. check corresponding task Actual results: { ... "name": "Creating Ansible Tower Credential (name=SomeCredentials)", "state": "Finished", "status": "Error", "message": "undefined method `id' for nil:NilClass", "userid": "system", ... } Expected results: Error message describing the problem (incorrect provider, type, etc.)
Relevant parts of evm.log attached. It's apparent the Ansible Tower provider is expected even if the "manager_resource" is in fact a Foreman provider.
The error is the same as described in https://bugzilla.redhat.com/show_bug.cgi?id=1476381 This error is not it's duplicate even though the error is the same. The problem this BZ is describing is that "type" is not checked with "manager_resource", not that it's not possible to create authentication on Ansible Tower.
https://github.com/ManageIQ/manageiq-providers-ansible_tower/pull/18
https://github.com/ManageIQ/manageiq-providers-ansible_tower/pull/20
*** Bug 1476381 has been marked as a duplicate of this bug. ***
PR https://github.com/ManageIQ/manageiq-providers-ansible_tower/pull/20 merged
New commit detected on ManageIQ/manageiq-providers-ansible_tower/master: https://github.com/ManageIQ/manageiq-providers-ansible_tower/commit/c5cbf2388a64bbf799ad250f18c0b5a947f00028 commit c5cbf2388a64bbf799ad250f18c0b5a947f00028 Author: James Wong <jwong> AuthorDate: Mon Aug 7 17:04:32 2017 -0400 Commit: James Wong <webpotent> CommitDate: Fri Nov 17 17:53:45 2017 -0500 validate provider/manager before queuing create_in_provider https://bugzilla.redhat.com/show_bug.cgi?id=1476327 .../providers/ansible_tower/shared/automation_manager/tower_api.rb | 5 +++++ spec/support/ansible_shared/automation_manager/credential.rb | 5 +++++ 2 files changed, 10 insertions(+)
FIXED. Verified on 5.10.0.31. Note: I still see database response in the message which could be avoided.
Since the problem described in this bug report should be resolved in a recent advisory, it has been closed with a resolution of ERRATA. For information on the advisory, and where to find the updated files, follow the link below. If the solution does not work for you, open a new bug report. https://access.redhat.com/errata/RHSA-2019:0212
Hi Parthvi, This bug is closed. If you would like to pursuit the improvement on the message, please open another issue. thanks, James