Bug 1576873 - automation executed on field refresh are called twice in self service dialogs
Summary: automation executed on field refresh are called twice in self service dialogs
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Red Hat CloudForms Management Engine
Classification: Red Hat
Component: UI - Service
Version: 5.9.0
Hardware: All
OS: All
high
high
Target Milestone: GA
: 5.10.0
Assignee: Oleg Barenboim
QA Contact: Shveta
URL:
Whiteboard:
Depends On:
Blocks: 1585745
TreeView+ depends on / blocked
 
Reported: 2018-05-10 15:29 UTC by Felix Dewaleyne
Modified: 2023-09-15 00:08 UTC (History)
10 users (show)

Fixed In Version: 5.10.0.0
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
: 1585745 (view as bug list)
Environment:
Last Closed: 2019-02-11 14:02:48 UTC
Category: ---
Cloudforms Team: CFME Core
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)
sample_method.rb (553 bytes, text/plain)
2018-05-10 15:29 UTC, Felix Dewaleyne
no flags Details
Sample image showing 2 field responders (86.54 KB, image/png)
2018-05-18 18:02 UTC, Chris Hale
no flags Details


Links
System ID Private Priority Status Summary Last Updated
Red Hat Bugzilla 1572711 0 urgent CLOSED Automate Methods from Dynamic Dialog are being Run More than Designed / Expected 2022-07-09 09:38:06 UTC
Red Hat Knowledge Base (Solution) 3459811 0 None None None 2018-05-25 11:49:06 UTC

Description Felix Dewaleyne 2018-05-10 15:29:03 UTC
Created attachment 1434443 [details]
sample_method.rb

Description of problem:
automation executed on field refresh are called twice in self service dialogs

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

How reproducible:
all the time

Steps to Reproduce:
1. setup an instance & automation method as attached that will populate the second field depending on the value of the first.
2. set up a dialog with two dropdown fields
3. the first dropbox field should list "a" and "b", both value and description and refresh the second when used. It should have for default selection "a"
4. the second dropbox field should call a method to load its values depending on the value of the first (see attached method)
5. attach a service to the dialog 
6. tail the automation log
7. provision the dialog through self_service

Actual results:
when changing the field to b and then back to a the logs show that the refresh method is being called twice for each refresh

Expected results:
the method is called only once

Additional info:
issue previously fixed for classical ui through bz#1572711 ; however the customer was not able to confirm the resolution in classical ui due to other issues.
the automation method is being called through an instance.

Comment 2 drew uhlmann 2018-05-11 19:02:58 UTC
This seems to be only a problem in the service UI with fields that have the load_values_on_init set, is that correct, Felix?

Comment 3 Felix Dewaleyne 2018-05-14 13:05:55 UTC
(In reply to drew uhlmann from comment #2)
> This seems to be only a problem in the service UI with fields that have the
> load_values_on_init set, is that correct, Felix?

the new dialog editor does not allow to make that kind of selection.

Once the value of field1 is changed to cause a refresh of field2 the method is ran twice, once with the initial value and once with the changed value.

Comment 5 Felix Dewaleyne 2018-05-14 13:10:59 UTC
for the sample dialog, no refresh button is displayed meaning that the interface doesn't allow to set up "load on init".

However the refresh method is called once at load time, which is correct, but twice when any change to the field1 is made.

Comment 8 Chris Hale 2018-05-16 18:18:30 UTC
I tested this in Service UI against the latest gaprindashvili codebase and was unable to reproduce this bug calling multiple times.   I am going to ask QA to test this and see if they can reproduce this and validate it.

Comment 12 Chris Hale 2018-05-17 13:32:53 UTC
So is this bug in Classic UI or Service UI?  We should reassign this issue for investigation in Classic UI if you are experiencing it in Classic UI

Comment 13 Felix Dewaleyne 2018-05-17 14:02:22 UTC
(In reply to Chris Hale from comment #12)
> So is this bug in Classic UI or Service UI?  We should reassign this issue
> for investigation in Classic UI if you are experiencing it in Classic UI

let's keep this bz for ssui.

Comment 15 Felix Dewaleyne 2018-05-17 14:14:21 UTC
proper log example :

load the sample two-field dialog :

[----] I, [2018-05-17T16:09:22.581937 #2132:177ba90]  INFO -- : User [admin] with current group ID [42000000000002] name [EvmGroup-super_administrator]
[----] I, [2018-05-17T16:09:22.584364 #2132:177ba90]  INFO -- : Instantiating [/Service/Provisioning/StateMachines/FillFields/test_value_1?MiqServer%3A%3Amiq_server=42000000000002&ServiceTemplate%3A%3Aservice_template=42000000000002&User%3A%3Auser=42000000000001&dialog_option=a&object_name=test_value_1&vmdb_object_type=service_template]
[----] I, [2018-05-17T16:09:22.778040 #2132:177ba90]  INFO -- : Updated namespace [/Service/Provisioning/StateMachines/FillFields/test_value_1?MiqServer%3A%3Amiq_server=42000000000002&ServiceTemplate%3A%3Aservice_template=42000000000002&User%3A%3Auser=42000000000001&dialog_option=a&object_name=test_value_1&vmdb_object_type=service_template  Banc_Sample/Service/Provisioning/StateMachines]
[----] I, [2018-05-17T16:09:23.039316 #2132:177ba90]  INFO -- : Updated namespace [Service/Provisioning/StateMachines/FillFields/test_value_1  Banc_Sample/Service/Provisioning/StateMachines]
[----] I, [2018-05-17T16:09:23.051822 #2132:177ba90]  INFO -- : Invoking [inline] method [/Banc_Sample/Service/Provisioning/StateMachines/FillFields/test_value_1] with inputs [{}]
[----] I, [2018-05-17T16:09:23.053038 #2132:177ba90]  INFO -- : <AEMethod [/Banc_Sample/Service/Provisioning/StateMachines/FillFields/test_value_1]> Starting 
[----] I, [2018-05-17T16:09:23.613512 #2132:437888c]  INFO -- : <AEMethod test_value_1> Value 1: a
[----] I, [2018-05-17T16:09:23.614167 #2132:437888c]  INFO -- : <AEMethod test_value_1> We are in A
[----] I, [2018-05-17T16:09:23.631694 #2132:177ba90]  INFO -- : <AEMethod [/Banc_Sample/Service/Provisioning/StateMachines/FillFields/test_value_1]> Ending
[----] I, [2018-05-17T16:09:23.631838 #2132:177ba90]  INFO -- : Method exited with rc=MIQ_OK

(only loaded once with defaults value a for field1)

changing value to b :

[----] I, [2018-05-17T16:10:36.454586 #2132:177b02c]  INFO -- : User [admin] with current group ID [42000000000002] name [EvmGroup-super_administrator]                                                                                      
[----] I, [2018-05-17T16:10:36.456445 #2132:177b02c]  INFO -- : Instantiating [/Service/Provisioning/StateMachines/FillFields/test_value_1?MiqServer%3A%3Amiq_server=42000000000002&ServiceTemplate%3A%3Aservice_template=42000000000002&User%3A%3Auser=42000000000001&dialog_option=a&object_name=test_value_1&vmdb_object_type=service_template]
[----] I, [2018-05-17T16:10:36.617363 #2132:177b02c]  INFO -- : Updated namespace [/Service/Provisioning/StateMachines/FillFields/test_value_1?MiqServer%3A%3Amiq_server=42000000000002&ServiceTemplate%3A%3Aservice_template=42000000000002&User%3A%3Auser=42000000000001&dialog_option=a&object_name=test_value_1&vmdb_object_type=service_template  Banc_Sample/Service/Provisioning/StateMachines]
[----] I, [2018-05-17T16:10:36.897633 #2132:177b02c]  INFO -- : Updated namespace [Service/Provisioning/StateMachines/FillFields/test_value_1  Banc_Sample/Service/Provisioning/StateMachines]                                             
[----] I, [2018-05-17T16:10:36.907178 #2132:177b02c]  INFO -- : Invoking [inline] method [/Banc_Sample/Service/Provisioning/StateMachines/FillFields/test_value_1] with inputs [{}]                                                        
[----] I, [2018-05-17T16:10:36.909679 #2132:177b02c]  INFO -- : <AEMethod [/Banc_Sample/Service/Provisioning/StateMachines/FillFields/test_value_1]> Starting                                                                              
[----] I, [2018-05-17T16:10:37.702768 #2132:10e0208]  INFO -- : <AEMethod test_value_1> Value 1: a                    
[----] I, [2018-05-17T16:10:37.703477 #2132:10e0208]  INFO -- : <AEMethod test_value_1> We are in A                   
[----] I, [2018-05-17T16:10:37.722511 #2132:177b02c]  INFO -- : <AEMethod [/Banc_Sample/Service/Provisioning/StateMachines/FillFields/test_value_1]> Ending                                                                                
[----] I, [2018-05-17T16:10:37.722651 #2132:177b02c]  INFO -- : Method exited with rc=MIQ_OK                          
[----] I, [2018-05-17T16:10:37.728471 #2132:177b02c]  INFO -- : User [admin] with current group ID [42000000000002] name [EvmGroup-super_administrator]                                                                                      
[----] I, [2018-05-17T16:10:37.730999 #2132:177b02c]  INFO -- : Instantiating [/Service/Provisioning/StateMachines/FillFields/test_value_1?MiqServer%3A%3Amiq_server=42000000000002&ServiceTemplate%3A%3Aservice_template=42000000000002&User%3A%3Auser=42000000000001&dialog_option=b&dialog_value=One&object_name=test_value_1&vmdb_object_type=service_template]
[----] I, [2018-05-17T16:10:37.896592 #2132:177b02c]  INFO -- : Updated namespace [/Service/Provisioning/StateMachines/FillFields/test_value_1?MiqServer%3A%3Amiq_server=42000000000002&ServiceTemplate%3A%3Aservice_template=42000000000002&User%3A%3Auser=42000000000001&dialog_option=b&dialog_value=One&object_name=test_value_1&vmdb_object_type=service_template  Banc_Sample/Service/Provisioning/StateMachines]
[----] I, [2018-05-17T16:10:38.147181 #2132:177b02c]  INFO -- : Updated namespace [Service/Provisioning/StateMachines/FillFields/test_value_1  Banc_Sample/Service/Provisioning/StateMachines]                                             
[----] I, [2018-05-17T16:10:38.160490 #2132:177b02c]  INFO -- : Invoking [inline] method [/Banc_Sample/Service/Provisioning/StateMachines/FillFields/test_value_1] with inputs [{}]                                                        
[----] I, [2018-05-17T16:10:38.161766 #2132:177b02c]  INFO -- : <AEMethod [/Banc_Sample/Service/Provisioning/StateMachines/FillFields/test_value_1]> Starting                                                                              
[----] I, [2018-05-17T16:10:38.678601 #2132:10e0604]  INFO -- : <AEMethod test_value_1> Value 1: b                    
[----] I, [2018-05-17T16:10:38.679184 #2132:10e0604]  INFO -- : <AEMethod test_value_1> We are in B                   
[----] I, [2018-05-17T16:10:38.697503 #2132:177b02c]  INFO -- : <AEMethod [/Banc_Sample/Service/Provisioning/StateMachines/FillFields/test_value_1]> Ending                                                                                
[----] I, [2018-05-17T16:10:38.697654 #2132:177b02c]  INFO -- : Method exited with rc=MIQ_OK   

(it runs once again with the old selection then once with the value b)

the same behaviour will be seen if selecting a again :
[----] I, [2018-05-17T16:11:59.298328 #2132:177b860]  INFO -- : User [admin] with current group ID [42000000000002] name [EvmGroup-super_administrator]                                                                                      
[----] I, [2018-05-17T16:11:59.299768 #2132:177b860]  INFO -- : Instantiating [/Service/Provisioning/StateMachines/FillFields/test_value_1?MiqServer%3A%3Amiq_server=42000000000002&ServiceTemplate%3A%3Aservice_template=42000000000002&User%3A%3Auser=42000000000001&dialog_option=a&object_name=test_value_1&vmdb_object_type=service_template]
[----] I, [2018-05-17T16:11:59.457597 #2132:177b860]  INFO -- : Updated namespace [/Service/Provisioning/StateMachines/FillFields/test_value_1?MiqServer%3A%3Amiq_server=42000000000002&ServiceTemplate%3A%3Aservice_template=42000000000002&User%3A%3Auser=42000000000001&dialog_option=a&object_name=test_value_1&vmdb_object_type=service_template  Banc_Sample/Service/Provisioning/StateMachines]
[----] I, [2018-05-17T16:11:59.664453 #2132:177b860]  INFO -- : Updated namespace [Service/Provisioning/StateMachines/FillFields/test_value_1  Banc_Sample/Service/Provisioning/StateMachines]                                             
[----] I, [2018-05-17T16:11:59.673595 #2132:177b860]  INFO -- : Invoking [inline] method [/Banc_Sample/Service/Provisioning/StateMachines/FillFields/test_value_1] with inputs [{}]                                                        
[----] I, [2018-05-17T16:11:59.674593 #2132:177b860]  INFO -- : <AEMethod [/Banc_Sample/Service/Provisioning/StateMachines/FillFields/test_value_1]> Starting                                                                              
[----] I, [2018-05-17T16:12:00.254170 #2132:10e0690]  INFO -- : <AEMethod test_value_1> Value 1: a                    
[----] I, [2018-05-17T16:12:00.254917 #2132:10e0690]  INFO -- : <AEMethod test_value_1> We are in A                   
[----] I, [2018-05-17T16:12:00.274052 #2132:177b860]  INFO -- : <AEMethod [/Banc_Sample/Service/Provisioning/StateMachines/FillFields/test_value_1]> Ending                                                                                
[----] I, [2018-05-17T16:12:00.274204 #2132:177b860]  INFO -- : Method exited with rc=MIQ_OK                          
[----] I, [2018-05-17T16:12:00.281220 #2132:177b860]  INFO -- : User [admin] with current group ID [42000000000002] name [EvmGroup-super_administrator]                                                                                      
[----] I, [2018-05-17T16:12:00.284169 #2132:177b860]  INFO -- : Instantiating [/Service/Provisioning/StateMachines/FillFields/test_value_1?MiqServer%3A%3Amiq_server=42000000000002&ServiceTemplate%3A%3Aservice_template=42000000000002&User%3A%3Auser=42000000000001&dialog_option=a&dialog_value=Five&object_name=test_value_1&vmdb_object_type=service_template]
[----] I, [2018-05-17T16:12:00.454817 #2132:177b860]  INFO -- : Updated namespace [/Service/Provisioning/StateMachines/FillFields/test_value_1?MiqServer%3A%3Amiq_server=42000000000002&ServiceTemplate%3A%3Aservice_template=42000000000002&User%3A%3Auser=42000000000001&dialog_option=a&dialog_value=Five&object_name=test_value_1&vmdb_object_type=service_template  Banc_Sample/Service/Provisioning/StateMachines]
[----] I, [2018-05-17T16:12:00.702670 #2132:177b860]  INFO -- : Updated namespace [Service/Provisioning/StateMachines/FillFields/test_value_1  Banc_Sample/Service/Provisioning/StateMachines]                                             
[----] I, [2018-05-17T16:12:00.712990 #2132:177b860]  INFO -- : Invoking [inline] method [/Banc_Sample/Service/Provisioning/StateMachines/FillFields/test_value_1] with inputs [{}]                                                        
[----] I, [2018-05-17T16:12:00.714210 #2132:177b860]  INFO -- : <AEMethod [/Banc_Sample/Service/Provisioning/StateMachines/FillFields/test_value_1]> Starting                                                                              
[----] I, [2018-05-17T16:12:01.491762 #2132:10e0410]  INFO -- : <AEMethod test_value_1> Value 1: a                    
[----] I, [2018-05-17T16:12:01.492387 #2132:10e0410]  INFO -- : <AEMethod test_value_1> We are in A                   
[----] I, [2018-05-17T16:12:01.510410 #2132:177b860]  INFO -- : <AEMethod [/Banc_Sample/Service/Provisioning/StateMachines/FillFields/test_value_1]> Ending                                                                                
[----] I, [2018-05-17T16:12:01.510549 #2132:177b860]  INFO -- : Method exited with rc=MIQ_OK 

note : name replaced by Sample in log output.

Comment 20 Tina Fitzgerald 2018-05-17 17:30:39 UTC
Hi Felix,

Using the customer provided Service Dialog and Automate domains, the Classic UI Service Dialog worked properly for us in a 5.9.2.4 appliance.
Dennis raised a very good point in that the customer upgraded, as opposed to installing a new 5.9.2.4 version.

Can you find out the customer version prior to the upgrade, and the specific upgrade steps performed?
Once we have that information, I'd like to get QE involved to see if we can reproduce the issue.

If we're not able to make significant progress today, Erik Clarizio would be available at 11AM tomorrow for a call with the customer for a interactive debugging session.

Let me know if you have any questions.

Thanks,
Tina

Comment 24 Chris Hale 2018-05-18 18:02:29 UTC
Created attachment 1438756 [details]
Sample image showing 2 field responders

Comment 32 drew uhlmann 2018-05-23 19:17:55 UTC
This might be fixed by https://github.com/ManageIQ/manageiq-ui-service/pull/1438 and the related API pr that Erik's working on.

Comment 33 Shveta 2018-05-23 22:35:27 UTC
I grep like this :
tail -f /var/www/miq/vmdb/log/automation.log | grep "Starting\|Ending"

Method is executed only once .
Verified in 5.9.3.0.20180522175053_3940873

Comment 38 drew uhlmann 2018-06-04 13:43:16 UTC
2) The API PR I mentioned isn't necessary for this to be fixed. 

As to 1), I think Shveta's setup wasn't sufficient to see this bug to start with because unless the steps from Ian were followed very specifically to the letter about how to setup this with Satellite, I don't believe this was ever reproduced in-house by cloudforms. I don't believe this has been adequately verified, we may have to check with Ian and see if the fix works for him before it can be.

Comment 41 Shveta 2018-07-10 17:10:30 UTC
Using the dialog attached in comment 28 . 
On changing values in dropdown from a to b , automate method is executed only once .
@ drew/Chris : Please check appliance - https://10.8.196.195/ui/service/
Service - automatemethod 
Is that is the right way to validate this BZ.

Comment 42 Shveta 2018-07-17 20:19:30 UTC
Working in 5.10.0.3.20180705151325_ce4d2b5

Comment 45 Red Hat Bugzilla 2023-09-15 00:08:04 UTC
The needinfo request[s] on this closed bug have been removed as they have been unresolved for 500 days


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