Bug 1460316 - Custom button failing to execute
Custom button failing to execute
Status: CLOSED ERRATA
Product: Red Hat CloudForms Management Engine
Classification: Red Hat
Component: UI - Service (Show other bugs)
5.8.0
Unspecified Unspecified
high Severity high
: GA
: 5.8.1
Assigned To: Allen W
Shveta
service
: ZStream
: 1469305 1470129 (view as bug list)
Depends On: 1454910
Blocks:
  Show dependency treegraph
 
Reported: 2017-06-09 12:51 EDT by Satoe Imaishi
Modified: 2017-08-02 13:28 EDT (History)
14 users (show)

See Also:
Fixed In Version: 5.8.1.2
Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: 1454910
Environment:
Last Closed: 2017-08-02 13:28:27 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: CFME Core


Attachments (Terms of Use)
error (58.61 KB, image/png)
2017-06-30 11:37 EDT, Shveta
no flags Details

  None (edit)
Comment 2 CFME Bot 2017-06-09 12:58:08 EDT
New commit detected on ManageIQ/manageiq-ui-service/fine:
https://github.com/ManageIQ/manageiq-ui-self_service/commit/2663f3b2df17f99ccf17cb3874ce591248559242

commit 2663f3b2df17f99ccf17cb3874ce591248559242
Author:     Chris Kacerguis <chriskacerguis@users.noreply.github.com>
AuthorDate: Thu May 25 09:47:37 2017 -0500
Commit:     Satoe Imaishi <simaishi@redhat.com>
CommitDate: Fri Jun 9 12:52:59 2017 -0400

    Merge pull request #791 from chalettu/vm-custom-button-actions
    
    Added support for a vm to submit a custom button action
    (cherry picked from commit 9860bdc1093adbb452b386a19eed98b38bfe9aec)
    
    https://bugzilla.redhat.com/show_bug.cgi?id=1460316

 .../custom-button/custom-button.component.js       |  6 +++
 .../custom-button/custom-button.component.spec.js  | 44 ++++++++++++++++++++++
 client/app/services/vm-details/vm-details.html     |  1 +
 3 files changed, 51 insertions(+)
Comment 3 Shveta 2017-06-29 02:25:08 EDT
Verification blocked by https://bugzilla.redhat.com/show_bug.cgi?id=1466114
Comment 4 Shveta 2017-06-30 11:37 EDT
Created attachment 1293285 [details]
error

Please check the attached screenshot .
Appliance : https://10.8.198.31/ui/service
Service - custom_button
Comment 5 Chris Hale 2017-07-05 16:08:28 EDT
Shveta.  I am going to need steps to reproduce this and if you possibly have this issue set up on an appliance that we can look at , please let me know.
Comment 6 Shveta 2017-07-05 16:40:20 EDT
Appliance - https://10.8.197.236/ui/service/

Service name - custom_button.
Click on the VM , Custom_button and click on Submit button. 
See Error .
Comment 7 Chris Kacerguis 2017-07-05 16:54:55 EDT
Seeing this error:

{"error":{"kind":"bad_request","message":"Unsupported Custom Action button for the services resource specified","klass":"Api::BadRequestError"}}

@Gregg - Can you take a look?
Comment 9 Chris Hale 2017-07-05 17:04:54 EDT
I attempted to reproduce the issue you had reported.  The API reported back 400 {"error":{"kind":"bad_request","message":"Unsupported Custom Action button for the services resource specified","klass":"Api::BadRequestError"}}.

For more detail, we posted 

{"action":"button","resource":{"service_name":"nAHlUqtPFZ"}}


to https://10.8.197.236/api/services/1
Comment 10 Tim Wade 2017-07-06 11:40:43 EDT
Chris H,

That looks like expected behavior. I've inspected that appliance and it looks like there are no CustomButtons set up for services. This needs to be done first.
Comment 11 Chris Kacerguis 2017-07-06 11:58:22 EDT
@Shveta - Can you please confirm that CustomButtons are set up for services?
Comment 12 Shveta 2017-07-06 12:14:06 EDT
The custom button was set up for VM and hence when clicked on VM the button shows up . 
 
The bug summary says " When clicking a custom button in the VM details level it failed with "Action to able to submit" in the UI, the production.log shows the following:"

On Vm details page , only VM button shows up .
Comment 13 Chris Kacerguis 2017-07-06 13:13:13 EDT
@Tim thoughts?

@Chris thoughts?
Comment 14 Jillian Tullo 2017-07-07 11:09:53 EDT
After looking into this bug, it appears that the SUI is making a call to the wrong href.

Because the custom button is on the VM, not on the service, the POST call should be made to

/api/vms/:id 
with 
{"action":"button","resource":{"service_name":"nAHlUqtPFZ"}}

not to /api/services/:id 

I went into the SUI to see what call is being made, and noticed that the call is being made incorrectly to services. I was then was able to verify that making the same call to the vms endpoint works correctly:

https://10.8.197.236/api/vms/59
{
  "action": "button",
  "resource": {
    "service_name": "nAHlUqtPFZ"
  }
}

Results in:
{"success":true,"message":"Invoked custom dialog action button for vms id: 59","href":"https://10.8.197.236/api/vms/59"}

Let me know if you have any questions!
Comment 16 Chris Kacerguis 2017-07-07 12:08:43 EDT
A Pivotal Tracker story has been created for this Bug: https://www.pivotaltracker.com/story/show/148493525
Comment 17 Allen W 2017-07-07 13:28:07 EDT
GOOD NEWS this plagues both master and fine, sooooo pr will be made master and packported.  Issue is we treat vm custom buttons the same as service custom buttons, working on the least invasive most natural course of differentiation.
Comment 19 Chris Kacerguis 2017-07-07 16:59:53 EDT
Chris Kacerguis added a comment in Pivotal Tracker:   
   
Commit by Allen Wight
https://github.com/ManageIQ/manageiq-ui-service/commit/c303177e74e3cdb0f433e74a40dbd15d9f014505

Ensure action target collection matches button class [Fixes #148493525]

Also addresses issue of inactionable error message
Comment 20 CFME Bot 2017-07-07 17:58:27 EDT
New commit detected on ManageIQ/manageiq-ui-service/fine:
https://github.com/ManageIQ/manageiq-ui-self_service/commit/a9986b0cda5a7911cb4f7c08a63801345f9d24e4

commit a9986b0cda5a7911cb4f7c08a63801345f9d24e4
Author:     Chris Kacerguis <chriskacerguis@users.noreply.github.com>
AuthorDate: Fri Jul 7 15:59:49 2017 -0500
Commit:     Satoe Imaishi <simaishi@redhat.com>
CommitDate: Fri Jul 7 17:56:10 2017 -0400

    Merge pull request #837 from AllenBW/BZ/#1460316-customInaction
    
    BZ#1460316 - Ensure action target collection matches button class
    (cherry picked from commit b3106155b4c2c760289d6d7352c16577a2e49a52)
    
    https://bugzilla.redhat.com/show_bug.cgi?id=1460316

 .../custom_button_details/custom_button_details.state.js       | 10 ++++++----
 .../custom_button_details/custom_button_details.state.spec.js  |  3 ++-
 2 files changed, 8 insertions(+), 5 deletions(-)
Comment 21 Shveta 2017-07-13 12:33:46 EDT
Fixed in 5.8.1.2.20170712143358_461cde4
Comment 22 Jillian Tullo 2017-07-14 15:04:56 EDT
*** Bug 1469305 has been marked as a duplicate of this bug. ***
Comment 23 Jillian Tullo 2017-07-14 15:11:01 EDT
*** Bug 1470129 has been marked as a duplicate of this bug. ***
Comment 25 errata-xmlrpc 2017-08-02 13:28:27 EDT
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-2017:1758

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