Bug 1476327 - provider type not checked when creating authentications, fails with undefined method `id' for nil:NilClass
Summary: provider type not checked when creating authentications, fails with undefined...
Alias: None
Product: Red Hat CloudForms Management Engine
Classification: Red Hat
Component: API
Version: 5.8.0
Hardware: Unspecified
OS: Unspecified
Target Milestone: GA
: 5.10.0
Assignee: James Wong
QA Contact: Parthvi Vala
Whiteboard: api:rest
: 1476381 (view as bug list)
Depends On:
TreeView+ depends on / blocked
Reported: 2017-07-28 16:03 UTC by Martin Kourim
Modified: 2019-10-23 02:45 UTC (History)
6 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Last Closed: 2019-02-07 23:02:39 UTC
Category: ---
Cloudforms Team: ---
Target Upstream Version:

Attachments (Terms of Use)

System ID Priority Status Summary Last Updated
Red Hat Product Errata RHSA-2019:0212 None None None 2019-02-07 23:02:48 UTC

Description Martin Kourim 2017-07-28 16:03:12 UTC
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):

How reproducible:

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.)

Comment 3 Martin Kourim 2017-07-28 18:38:54 UTC
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.

Comment 4 Martin Kourim 2017-07-28 18:51:17 UTC
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.

Comment 10 James Wong 2017-11-07 14:39:41 UTC
*** Bug 1476381 has been marked as a duplicate of this bug. ***

Comment 12 CFME Bot 2017-12-12 14:05:04 UTC
New commit detected on ManageIQ/manageiq-providers-ansible_tower/master:

commit c5cbf2388a64bbf799ad250f18c0b5a947f00028
Author:     James Wong <jwong@jwong-OSX.local>
AuthorDate: Mon Aug 7 17:04:32 2017 -0400
Commit:     James Wong <webpotent@gmail.com>
CommitDate: Fri Nov 17 17:53:45 2017 -0500

    validate provider/manager before queuing create_in_provider

 .../providers/ansible_tower/shared/automation_manager/tower_api.rb   | 5 +++++
 spec/support/ansible_shared/automation_manager/credential.rb         | 5 +++++
 2 files changed, 10 insertions(+)

Comment 14 Parthvi Vala 2019-01-16 07:50:07 UTC
FIXED. Verified on

Note: I still see database response in the message which could be avoided.

Comment 15 errata-xmlrpc 2019-02-07 23:02:39 UTC
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.


Comment 16 James Wong 2019-10-23 02:45:39 UTC
Hi Parthvi,

This bug is closed.  If you would like to pursuit the improvement on the message, please open another issue.


Note You need to log in before you can comment on or make changes to this bug.