Note: This is a beta release of Red Hat Bugzilla 5.0. The data contained within is a snapshot of the live data so any changes you make will not be reflected in the production Bugzilla. Also email is disabled so feel free to test any aspect of the site that you want. File any problems you find or give feedback here.

Bug 1518283

Summary: the "resource_action" of custom button points to non-existent resource
Product: Red Hat CloudForms Management Engine Reporter: Martin Kourim <mkourim>
Component: APIAssignee: Gregg Tanzillo <gtanzill>
Status: CLOSED CURRENTRELEASE QA Contact: Martin Kourim <mkourim>
Severity: high Docs Contact:
Priority: high    
Version: 5.9.0CC: cpelland, jhardy, obarenbo, yrudman
Target Milestone: GAKeywords: TestOnly
Target Release: 5.10.0   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard: api:generic_objects
Fixed In Version: 5.10.0.0 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of:
: 1527563 (view as bug list) Environment:
Last Closed: 2018-06-21 20:27:06 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: CFME Core Target Upstream Version:
Bug Depends On:    
Bug Blocks: 1527563    

Description Martin Kourim 2017-11-28 14:50:22 UTC
Description of problem:
When custom button is added for Generic Object Definition the "resource_action" attribute points to https://<addr>/api/resource_action/:id
There's no "resource_action" collection.


Version-Release number of selected component (if applicable):
5.9.0.11


How reproducible:
very


Steps to Reproduce:
1. create Generic Object Definition
2. add Button Group
3. add Button
4. GET /api/custom_buttons/:id?attributes=resource_action
5. check the "resource" action:
...
    "resource_action": {
        "href": "https://<addr>/api/resource_action/44",
        "id": "44",
        "resource_id": "1",
        "resource_type": "CustomButton",

Comment 2 Martin Kourim 2017-11-29 15:36:17 UTC
Even though the "resource_action" of custom button points to non-existent resource, the action is executed successfully:

POST /api/generic_objects/1
{
   "action": "btn01"
}

Response:
{
    "success": true,
    "message": "Invoked custom action btn01 for generic_objects id: 1",
    "href": "https://<addr>/api/generic_objects/1"
}

Comment 5 CFME Bot 2017-12-18 20:10:34 UTC
New commit detected on ManageIQ/manageiq-api/master:
https://github.com/ManageIQ/manageiq-api/commit/d1f3d947a70e3bdbb39ae260af9a59d963ac0a11

commit d1f3d947a70e3bdbb39ae260af9a59d963ac0a11
Author:     Chris Arcand <chris@chrisarcand.com>
AuthorDate: Mon Dec 18 12:15:12 2017 -0600
Commit:     Chris Arcand <chris@chrisarcand.com>
CommitDate: Mon Dec 18 12:17:05 2017 -0600

    Don't return non-existent hrefs
    
    Fixes https://bugzilla.redhat.com/show_bug.cgi?id=1518283

 app/controllers/api/base_controller/normalizer.rb | 26 +++++++++++++++--------
 lib/api/href.rb                                   |  6 ++++++
 2 files changed, 23 insertions(+), 9 deletions(-)