Bug 1386258

Summary: incorrect href attribute values for Foreman providers
Product: Red Hat CloudForms Management Engine Reporter: Martin Kourim <mkourim>
Component: APIAssignee: Jillian Tullo <jtullo>
Status: CLOSED CURRENTRELEASE QA Contact: Martin Kourim <mkourim>
Severity: medium Docs Contact:
Priority: high    
Version: 5.7.0CC: cpelland, dajohnso, jhardy, jtullo, obarenbo, simaishi
Target Milestone: GAKeywords: TestOnly
Target Release: 5.9.0   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard: api:rest:provider:satellite
Fixed In Version: 5.9.0.1 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of:
: 1446790 1446791 1446792 (view as bug list) Environment:
Last Closed: 2018-03-06 14:58:48 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: Satellite Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 1446790, 1446791, 1446792    

Description Martin Kourim 2016-10-18 13:49:10 UTC
Description of problem:

Foreman providers are accessed by "provider_class=provider" parameter.
When e.g. adding new Foreman provider with

POST /api/providers?provider_class=provider
{
  "type"      : "ManageIQ::Providers::Foreman::Provider",
  "name"      : "new_foreman_111",
  "url"       : "100.200.300.111",
  "credentials" : {
    "userid"   : "foreman_admin",
    "password" : "foreman_password"
  }
}

href attributes of the newly added provider points to incorrect locations
{
  "href": "https://<address>/api/providers/1",
  "id": 1,
  ...
  "actions": [
    {
      "name": "edit",
      "method": "post",
      "href": "https://<address>/api/providers/1"
      ...

Correct location would be
https://<address>/api/providers/1?provider_class=provider
Location https://<address>/api/providers/1 points to "normal" provider.


How reproducible:
100%

Comment 4 CFME Bot 2017-04-07 20:26:13 UTC
New commit detected on ManageIQ/manageiq/master:
https://github.com/ManageIQ/manageiq/commit/60e75da417a271cd8d8bd0685c19941c2fa83dc3

commit 60e75da417a271cd8d8bd0685c19941c2fa83dc3
Author:     Jillian Tullo <jtullo>
AuthorDate: Wed Apr 5 14:26:28 2017 -0400
Commit:     Jillian Tullo <jtullo>
CommitDate: Thu Apr 6 08:33:56 2017 -0400

    add api_suffix to append hrefs
    
    https://bugzilla.redhat.com/show_bug.cgi?id=1386258

 app/controllers/api/base_controller/normalizer.rb  |  3 ++-
 .../api/base_controller/parser/request_adapter.rb  |  4 +++
 spec/requests/api/providers_spec.rb                | 31 ++++++++++++++++++++++
 3 files changed, 37 insertions(+), 1 deletion(-)

Comment 8 Martin Kourim 2017-10-24 08:00:27 UTC
Verified that the href attribute now points to the correct location /api/providers/:id?provider_class=provider