Bug 1476327
| Summary: | provider type not checked when creating authentications, fails with undefined method `id' for nil:NilClass | ||
|---|---|---|---|
| Product: | Red Hat CloudForms Management Engine | Reporter: | Martin Kourim <mkourim> |
| Component: | API | Assignee: | James Wong <jwong> |
| Status: | CLOSED ERRATA | QA Contact: | Parthvi Vala <pvala> |
| Severity: | medium | Docs Contact: | |
| Priority: | high | ||
| Version: | 5.8.0 | CC: | jhardy, jwong, obarenbo, pvala, simaishi, smallamp |
| Target Milestone: | GA | ||
| Target Release: | 5.10.0 | ||
| Hardware: | Unspecified | ||
| OS: | Unspecified | ||
| Whiteboard: | api:rest | ||
| Fixed In Version: | 5.10.0.0 | Doc Type: | If docs needed, set a value |
| Doc Text: | Story Points: | --- | |
| Clone Of: | Environment: | ||
| Last Closed: | 2019-02-07 23:02:39 UTC | Type: | Bug |
| Regression: | --- | Mount Type: | --- |
| Documentation: | --- | CRM: | |
| Verified Versions: | Category: | --- | |
| oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |
| Cloudforms Team: | --- | Target Upstream Version: | |
| Embargoed: | |||
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. *** Bug 1476381 has been marked as a duplicate of this bug. *** 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 |
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.)