Bug 1698439

Summary: Dialogs based on an AWS orchestration template pass "0" instead of custom value set in dialog
Product: Red Hat CloudForms Management Engine Reporter: Felix Dewaleyne <fdewaley>
Component: ProvisioningAssignee: Lucy Fu <lufu>
Status: CLOSED CURRENTRELEASE QA Contact: Niyaz Akhtar Ansari <nansari>
Severity: high Docs Contact: Red Hat CloudForms Documentation <cloudforms-docs>
Priority: high    
Version: 5.10.2CC: dmetzger, fdewaley, gmccullo, jhardy, lufu, mshriver, obarenbo, simaishi, tfitzger, vaclav.miller
Target Milestone: GAKeywords: TestOnly, ZStream
Target Release: 5.11.0   
Hardware: All   
OS: All   
Whiteboard:
Fixed In Version: 5.11.0.1 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of:
: 1702070 (view as bug list) Environment:
Last Closed: 2019-12-13 15:09:01 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: Bug
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: CFME Core Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 1702070    

Description Felix Dewaleyne 2019-04-10 11:29:37 UTC
Description of problem:
Dialogs based on an AWS orchestration template pass "0" instead of custom value set in dialog 

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

How reproducible:
customer environment

Steps to Reproduce:
1.create an aws template with an optional value "timeout"
2.create a dialog that will offer an option to overwrite "timeout" with a custom value typed at input
3. provision using a non-zero value in timeout

Actual results:
the value 0 is passed to automate : 
[----] I, [2019-04-09T14:58:58.320711 #5581:5a3eee0]  INFO -- : Q-task_id([r10000000000054_service_template_provision_task_10000000000140]) <AEMethod enviteminitialization> VMI EnvName: c5cac93fa
[----] E, [2019-04-09T14:59:13.100367 #5589:a56f54] ERROR -- : Q-task_id([r10000000000054_service_template_provision_task_10000000000140]) MIQ(ManageIQ::Providers::Amazon::CloudManager::OrchestrationStack.raw_create_stack) stack=[c5cac93fa], error: 1 validation error detected: Value '0' at 'timeoutInMinutes' failed to satisfy constraint: Member must have value greater than or equal to 1
[----] E, [2019-04-09T14:59:13.100824 #5589:a56f54] ERROR -- : Q-task_id([r10000000000054_service_template_provision_task_10000000000140]) [MiqException::MiqOrchestrationProvisionError]: 1 validation error detected: Value '0' at 'timeoutInMinutes' failed to satisfy constraint: Member must have value greater than or equal to 1  Method:[block (2 levels) in <class:LogProxy>]
[----] E, [2019-04-09T15:08:51.625095 #5581:a56f54] ERROR -- : Q-task_id([r10000000000054_service_template_provision_task_10000000000140]) Terminating non responsive method with pid 7927
[----] E, [2019-04-09T15:08:51.626492 #5581:6319bb4] ERROR -- : Q-task_id([r10000000000054_service_template_provision_task_10000000000140]) <AEMethod provision> The following error occurred during method evaluation:
[----] E, [2019-04-09T15:08:51.626922 #5581:6319bb4] ERROR -- : Q-task_id([r10000000000054_service_template_provision_task_10000000000140]) <AEMethod provision>   SignalException: SIGTERM
[----] E, [2019-04-09T15:08:51.628282 #5581:6319bb4] ERROR -- : Q-task_id([r10000000000054_service_template_provision_task_10000000000140]) <AEMethod provision>   /usr/share/ruby/drb/drb.rb:575:in `read'
[----] E, [2019-04-09T15:08:51.741266 #5581:a56f54] ERROR -- : Q-task_id([r10000000000054_service_template_provision_task_10000000000140]) MIQ(MiqQueue#deliver) Message id: [10000000351816], timed out after 600.117136152 seconds.  Timeout threshold [600]
[----] E, [2019-04-09T15:09:02.363001 #5262:a56f54] ERROR -- : MIQ(MiqServer#validate_worker) Worker [MiqGenericWorker] with ID: [10000000001304], PID: [5581], GUID: [a24c3315-7430-44b6-bfa3-d43871b41324] has not responded in 610.74614868 seconds, restarting worker
[----] E, [2019-04-09T15:09:11.812966 #5581:a56f54] ERROR -- : Q-task_id([r10000000000054_service_template_provision_task_10000000000140]) MIQ(MiqGenericWorker::Runner) ID [10000000001304] PID [5581] GUID [a24c3315-7430-44b6-bfa3-d43871b41324] Exiting worker due to timeout error Worker exiting.

Expected results:
the value inputted is passed. 

Additional info:

Comment 3 Felix Dewaleyne 2019-04-10 16:13:56 UTC
Additional scenario :


1. create AWS orchestration template
2. generate dialog from the template
3. create catalog item with template and dialog
4. order service
5. during the order, for the optional value place a valid number above 0.

result : the value inputed for optional fields will turn into 0.

Comment 5 Felix Dewaleyne 2019-04-11 10:19:27 UTC
After talking with the customer, I must correct previous updates -  the issue happens when the optional field is *not* filled in, not when it is filled with valid data : 

1. create AWS orchestration template
2. generate dialog from the template
3. create catalog item with template and dialog
4. order service
5. during the order, leave the optional field unset

result : the value 0 is set instead of None, making validation fail.

expected : None is passed and not 0

Comment 6 Greg McCullough 2019-04-12 19:33:24 UTC
Based on error message coming back from the Provider I would suggest (and confirmed with BillW) that we should protect the logic here:
https://github.com/ManageIQ/manageiq-providers-amazon/blob/master/app/models/manageiq/providers/amazon/cloud_manager/orchestration_service_option_converter.rb#L6-L12

If we to_i the dialog value and it is zero we should pass nil.

Comment 9 CFME Bot 2019-04-15 20:41:24 UTC
New commit detected on ManageIQ/manageiq-providers-amazon/master:

https://github.com/ManageIQ/manageiq-providers-amazon/commit/261af4d77052be0c211d68952b7f280b4f02cebe
commit 261af4d77052be0c211d68952b7f280b4f02cebe
Author:     Lucy Fu <lufu>
AuthorDate: Mon Apr 15 09:41:15 2019 -0400
Commit:     Lucy Fu <lufu>
CommitDate: Mon Apr 15 09:41:15 2019 -0400

    Return not set timeout in dialog as nil instead of 0.

    To pass the validation on timeoutInMinutes that the value must be greater than or equal to 1.

    https://bugzilla.redhat.com/show_bug.cgi?id=1698439

 app/models/manageiq/providers/amazon/cloud_manager/orchestration_service_option_converter.rb | 4 +-
 spec/models/manageiq/providers/amazon/cloud_manager/orchestration_service_option_converter_spec.rb | 9 +-
 2 files changed, 10 insertions(+), 3 deletions(-)