Bug 1518283 - the "resource_action" of custom button points to non-existent resource
Summary: the "resource_action" of custom button points to non-existent resource
Alias: None
Product: Red Hat CloudForms Management Engine
Classification: Red Hat
Component: API
Version: 5.9.0
Hardware: Unspecified
OS: Unspecified
Target Milestone: GA
: 5.10.0
Assignee: Gregg Tanzillo
QA Contact: Martin Kourim
Whiteboard: api:generic_objects
Depends On:
Blocks: 1527563
TreeView+ depends on / blocked
Reported: 2017-11-28 14:50 UTC by Martin Kourim
Modified: 2019-08-06 20:04 UTC (History)
4 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
: 1527563 (view as bug list)
Last Closed: 2018-06-21 20:27:06 UTC
Category: ---
Cloudforms Team: CFME Core
Target Upstream Version:

Attachments (Terms of Use)

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

How reproducible:

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"

    "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:

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

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