Bugzilla will be upgraded to version 5.0. The upgrade date is tentatively scheduled for 2 December 2018, pending final testing and feedback.
Bug 1610685 - Service Dialog CheckBox has null value when not ticked by default
Service Dialog CheckBox has null value when not ticked by default
Status: CLOSED ERRATA
Product: Red Hat CloudForms Management Engine
Classification: Red Hat
Component: Automate (Show other bugs)
5.9.3
Unspecified Unspecified
high Severity medium
: GA
: 5.9.4
Assigned To: drew uhlmann
Shveta
: ZStream
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2018-08-01 04:20 EDT by Nikhil Gupta
Modified: 2018-10-02 03:38 EDT (History)
8 users (show)

See Also:
Fixed In Version: 5.9.4.4
Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2018-09-04 14:01:40 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)
unrelated API issue -- payload without checkbox (10.00 KB, image/png)
2018-08-22 08:32 EDT, drew uhlmann
no flags Details


External Trackers
Tracker ID Priority Status Summary Last Updated
Red Hat Knowledge Base (Solution) 3635361 None None None 2018-10-02 03:38 EDT
Red Hat Product Errata RHSA-2018:2561 None None None 2018-09-04 14:02 EDT

  None (edit)
Description Nikhil Gupta 2018-08-01 04:20:34 EDT
Description of problem:
Service Dialog CheckBox has null value when not ticked by default.
- When I directly order a service without touching the checkbox, the value is blank or null:
~~~
[----] I, [2018-08-01T01:59:27.627205 #1322:12b24a0]  INFO -- : <AEMethod groupsequencecheck> 	dialog_check_box_1: 
[----] I, [2018-08-01T01:59:31.161251 #1322:100570c]  INFO -- : <AEMethod dialog_parser> dialog_options: {"dialog_check_box_1"=>"", "dialog_textarea_box_1"=>"", "request"=>"clone_to_service", :service_action=>"Provision", "Service::Service"=>99000000000045}
[----] I, [2018-08-01T01:59:36.382484 #1322:1024e18]  INFO -- : <AEMethod dialog_parser> dialog_options: {"dialog_check_box_1"=>"", "dialog_textarea_box_1"=>"", "request"=>"clone_to_service", :service_action=>"Provision", "Service::Service"=>99000000000045}
[----] I, [2018-08-01T01:59:47.818039 #1322:132269c]  INFO -- : <AEMethod provision> 	dialog_check_box_1: 
[----] I, [2018-08-01T01:59:50.356531 #1322:1337308]  INFO -- : <AEMethod check_provisioned> 	dialog_check_box_1: 
~~~

- When I tick and untick the checkbox, the value sets as "f":
~~~
[----] I, [2018-08-01T01:57:27.166002 #1322:121af4c]  INFO -- : <AEMethod groupsequencecheck> 	dialog_check_box_1: f
[----] I, [2018-08-01T01:57:30.622854 #1322:100570c]  INFO -- : <AEMethod dialog_parser> dialog_options: {"dialog_check_box_1"=>"f", "dialog_textarea_box_1"=>"", "request"=>"clone_to_service", :service_action=>"Provision", "Service::Service"=>99000000000044}
[----] I, [2018-08-01T01:57:30.625480 #1322:100570c]  INFO -- : <AEMethod dialog_parser> Adding seq_id: 0 key: dialog_check_box_1 value: f 
[----] I, [2018-08-01T01:57:30.685579 #1322:100570c]  INFO -- : <AEMethod dialog_parser> parsed_dialog_options: "---\n0:\n  :check_box_1: f\n  :dialog_check_box_1: f\n"
[----] I, [2018-08-01T01:57:34.440244 #1322:10056a8]  INFO -- : <AEMethod catalogiteminitialization> merged_options_hash: {:check_box_1=>"f", :dialog_check_box_1=>"f"}
[----] I, [2018-08-01T01:57:34.566287 #1322:10056a8]  INFO -- : <AEMethod catalogiteminitialization> Adding Option: {dialog_check_box_1 => f} to Destination id: 99000000000044
[----] I, [2018-08-01T01:57:44.259913 #1322:1255fd4]  INFO -- : <AEMethod provision> 	dialog_check_box_1: f
[----] I, [2018-08-01T01:57:46.803777 #1322:125e990]  INFO -- : <AEMethod check_provisioned> 	dialog_check_box_1: f
~~~

Version-Release number of selected component (if applicable):
cfme-5.9.3.4-1.el7cf.x86_64

How reproducible:
Always

Steps to Reproduce:
1. Create Service Dialog with the following elements
    - Checkbox ( not ticked)
    - Dynamic Text Area 
        use the following code for the dynamic text area
        #####################
        check_box  =  $evm.root['dialog_check_box_1']
        puts "#{check_box}"
        ###################
   In the Checkbox element, add refresh field to "Text Area"

2. Create a Service catalog Item and use the newly created Service Dialog

3. Order the Service catalog item

4. Check automation.log 

Actual results:
The default value is blank or null.

Expected results:
We expect that during the initial Service dialog load, by default, the value of the checkbox will be "f".

Additional info:
- Ticking the Checkbox will shows the value of "t", then untick will now have the value of "f".
Comment 3 drew uhlmann 2018-08-01 13:41:22 EDT
@Nikhil, could you please tell me if this is a regression?
Comment 5 drew uhlmann 2018-08-02 16:14:14 EDT
This works on master, and it also works if you set the field to have a default value of false.
Comment 6 drew uhlmann 2018-08-02 17:47:42 EDT
@Nikhil! Sorry about this, but could you please retest this on your appliance? I have a one line change made on that system in app/models/dialog_field_check_box.rb.
Comment 8 drew uhlmann 2018-08-07 10:14:07 EDT
https://github.com/ManageIQ/manageiq/pull/17810
Comment 10 Shveta 2018-08-21 16:37:32 EDT
I am seeing 

====================
 <AEMethod dialog_parser> dialog_options: {"dialog_check_box_1"=>nil, "dialog_textarea_box_1"=>"", "request"=>"clone_to_service", :service_action=>"Provision", "Service::Service"=>6}
=========================

When the checkbox is not set to any value . 
It shows "nil "
Is it supposed to show 'f' as stated in the issue ?

Appliance : https://10.8.199.142
Service : catalog_item
Comment 11 drew uhlmann 2018-08-22 07:57:37 EDT
Hey Shveta. So the original bug for which this ticket was filed was about the backend code not setting the value correctly. The issue I'm seeing on your appliance is a different issue. I verified originally that the API payload had the right value -- f, just like you mentioned -- but on your appliance for some reason, the API isn't showing the same thing. Since Nikhil confirmed that my fix worked for the issue he was seeing, can you please verify this ticket and reopen a similar ticket on the API? You can assign that ticket to me, that's fine, but I'd like to be very clear that these are separate issues.
Comment 12 drew uhlmann 2018-08-22 08:30:39 EDT
Looking into the API issue further, I think you'll find that if you try to submit the dialog without changing the checkbox at all, the API payload doesn't even list the checkbox as a field.
Comment 13 drew uhlmann 2018-08-22 08:32 EDT
Created attachment 1477871 [details]
unrelated API issue -- payload without checkbox
Comment 14 Shveta 2018-08-22 12:44:28 EDT
Verifying based on above comment and opening new BZ for API issue 
https://bugzilla.redhat.com/show_bug.cgi?id=1620208
Comment 16 errata-xmlrpc 2018-09-04 14:01:40 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-2018:2561

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