Bug 1651099 - Custom button attribute override message
Summary: Custom button attribute override message
Alias: None
Product: Red Hat CloudForms Management Engine
Classification: Red Hat
Component: Automate
Version: 5.10.0
Hardware: Unspecified
OS: Unspecified
Target Milestone: GA
: 5.11.0
Assignee: drew uhlmann
QA Contact: Nikhil Dhandre
Red Hat CloudForms Documentation
Depends On:
Blocks: 1672693
TreeView+ depends on / blocked
Reported: 2018-11-19 08:23 UTC by Cyril Coupel
Modified: 2019-12-13 15:16 UTC (History)
12 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
: 1672693 (view as bug list)
Last Closed: 2019-12-13 15:16:08 UTC
Category: ---
Cloudforms Team: CFME Core
Target Upstream Version:

Attachments (Terms of Use)
Before Attachment (53.22 KB, image/png)
2018-11-27 20:57 UTC, William Fitzgerald
no flags Details
After Attachment (73.77 KB, image/png)
2018-11-27 20:57 UTC, William Fitzgerald
no flags Details

Description Cyril Coupel 2018-11-19 08:23:48 UTC
Description of problem:
when creating a custom button to request call_instance_with_message, the message attribut override the message of the request

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

How reproducible:
every time

Steps to Reproduce:
1. create a custom button to request the call_instance_with_message
2. set the message to create
3. set the attributes instance, class, namespace to "whatever"
4. set the attribute message to "my_message"
5. save it

Actual results:
the message of the request is set to the value of the message attribute "my_message" instead of "create"

Expected results:
the message is set to "create" and the message attribute is set to "my_message"

Additional info:

Comment 2 William Fitzgerald 2018-11-27 20:55:49 UTC
The UI is changing the value of message in Object Details (see Before Attachment) to the value of message in Attribute/Value Pairs (see After Attachment).

Comment 3 William Fitzgerald 2018-11-27 20:57:12 UTC
Created attachment 1509206 [details]
Before Attachment

Comment 4 William Fitzgerald 2018-11-27 20:57:59 UTC
Created attachment 1509207 [details]
After Attachment

Comment 5 William Fitzgerald 2018-11-27 21:07:44 UTC
I recreated this on appliance  I created a button called 'call instance with message' on VM and Instance.

Comment 6 Dávid Halász 2018-11-28 11:16:18 UTC
Hi Billy,

I backtraced this to the `MiqAeEngine.create_automation_object` method in the automation engine gem. I added the breakpoint after the [1] call of this method and found out that the generated URI doesn't contain the "create" as the message, but it uses the message from the attribute/value pairs, i.e. "billy%20messages". Then to set the message for the DB record, this URI is being parsed [2]. 

=> "create"

=> "/SYSTEM/PROCESS/Request?MiqServer%3A%3Amiq_server=16&User%3A%3Auser=1&class=Request&instance=TestNotification&message=billy%20messages&namespace=%2FSystem&object_name=Request#billy%20messages"

My question: is this a bug or a feature in the `create_automation_object` method, i.e. does it behave wrong or should I work this around?

[1] https://github.com/ManageIQ/manageiq-ui-classic/blob/master/app/controllers/application_controller/buttons.rb#L532

[2] https://github.com/ManageIQ/manageiq-ui-classic/blob/master/app/controllers/application_controller/buttons.rb#L865

Comment 7 William Fitzgerald 2018-11-29 19:42:17 UTC
Hi David,

#billy%20messages" - This needs to be create, this is the object message
&message=billy%20messages - This is correct, This is the attribute message

The attribute message is overriding the object message and it should not.



Comment 8 William Fitzgerald 2018-11-29 19:52:46 UTC
For Comment 7

Comment 11 drew uhlmann 2019-01-14 20:58:42 UTC
Sorry Dávid, totally giving this back to you since it looks to be wrong before it ever hits Automate.

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