Bug 1481380

Summary: Custom button not passing target object to dynamic dialog fields
Product: Red Hat CloudForms Management Engine Reporter: Greg McCullough <gmccullo>
Component: AutomateAssignee: eclarizi
Status: CLOSED CURRENTRELEASE QA Contact: Dmitry Misharov <dmisharo>
Severity: medium Docs Contact:
Priority: medium    
Version: 5.7.0CC: eclarizi, jhardy, mfalesni, mkanoor, obarenbo, simaishi, tfitzger
Target Milestone: GAKeywords: TestOnly, ZStream
Target Release: 5.9.0   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: 5.9.0.1 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of:
: 1484539 1484541 (view as bug list) Environment:
Last Closed: 2018-03-06 15:11:05 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 1484539, 1484541    

Description Greg McCullough 2017-08-14 19:34:02 UTC
Description of problem: When running a custom button the dynamic dialog fields should be passed the target object of the button.


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


How reproducible: Always


Steps to Reproduce:
1. Create new Service Dialog with dynamic dialog field (point to /System/Request/InspectMe instance)
2. Attach dialog to custom button for a VM or Service
3. Run the dialog and view automation.log


Actual results:
Logging shows that the target object (vmdb_object_type) is not passed.
INFO -- : <AEMethod checkbox> Root:<$evm.root> Attributes - Begin
INFO -- : <AEMethod checkbox>   Attribute - miq_group: #<MiqAeMethodService::MiqAeServiceMiqGroup:0x007f8395252a68>
INFO -- : <AEMethod checkbox>   Attribute - miq_server: #<MiqAeMethodService::MiqAeServiceMiqServer:0x007f83989dcab0>
INFO -- : <AEMethod checkbox>   Attribute - miq_server_id: 14
INFO -- : <AEMethod checkbox>   Attribute - object_name: checkbox
INFO -- : <AEMethod checkbox>   Attribute - tenant: #<MiqAeMethodService::MiqAeServiceTenant:0x007f83aeec5840>
INFO -- : <AEMethod checkbox>   Attribute - user: #<MiqAeMethodService::MiqAeServiceUser:0x007f83955c6168>
INFO -- : <AEMethod checkbox>   Attribute - user_id: 1
INFO -- : <AEMethod checkbox> Root:<$evm.root> Attributes - End

Expected results:
Target object (vmdb_object_type) is passed with a handle to the object:
INFO -- : <AEMethod checkbox> Root:<$evm.root> Attributes - Begin
INFO -- : <AEMethod checkbox>   Attribute - miq_group: #<MiqAeMethodService::MiqAeServiceMiqGroup:0x007fede4a31400>
INFO -- : <AEMethod checkbox>   Attribute - miq_server: #<MiqAeMethodService::MiqAeServiceMiqServer:0x007fee026c4150>
INFO -- : <AEMethod checkbox>   Attribute - miq_server_id: 14
INFO -- : <AEMethod checkbox>   Attribute - object_name: checkbox
INFO -- : <AEMethod checkbox>   Attribute - service: #<MiqAeMethodService::MiqAeServiceService:0x007fee025cc1d0>
INFO -- : <AEMethod checkbox>   Attribute - service_id: 412
INFO -- : <AEMethod checkbox>   Attribute - tenant: #<MiqAeMethodService::MiqAeServiceTenant:0x007fee02b62ce8>
INFO -- : <AEMethod checkbox>   Attribute - user: #<MiqAeMethodService::MiqAeServiceUser:0x007fee02c32470>
INFO -- : <AEMethod checkbox>   Attribute - user_id: 1
INFO -- : <AEMethod checkbox>   Attribute - vmdb_object_type: service
INFO -- : <AEMethod checkbox> Root:<$evm.root> Attributes - End


Additional info:

Comment 3 Greg McCullough 2017-08-14 20:39:04 UTC
Digging into this issue further it appear the code has been this way for a while (years) and has only now been identified.  The fields exposed to this issue are not common fields for dynamic use, or do not need to target object when they are dynamic.  (I dropped the severity of the BZ based on this.)

Effected fields: check_box, date_control, date_time_control, text_box and text_box_area

QE(Milan) - Is this something you could create an integration tests for?

Comment 4 CFME Bot 2017-08-14 21:41:36 UTC
New commit detected on ManageIQ/manageiq/master:
https://github.com/ManageIQ/manageiq/commit/f8f29e8424cfce157e9129b5dbb38826f6f61116

commit f8f29e8424cfce157e9129b5dbb38826f6f61116
Author:     Erik Clarizio <eclarizi>
AuthorDate: Mon Aug 14 11:05:36 2017 -0700
Commit:     Erik Clarizio <eclarizi>
CommitDate: Mon Aug 14 12:34:45 2017 -0700

    Ensure dialog is set before calling `.value`
    
    https://bugzilla.redhat.com/show_bug.cgi?id=1481380

 app/models/dialog.rb | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comment 5 Greg McCullough 2017-08-15 10:48:37 UTC
Discovered this issue while working on PR https://github.com/ManageIQ/manageiq-content/pull/170.

Comment 9 Milan Falešník 2017-10-11 09:37:45 UTC
Verified in 5.9.0.1