Bug 1696220

Summary: CloudForms Null Coalescing fields in Ansible Playbook Methods do not Coalesce
Product: Red Hat CloudForms Management Engine Reporter: Chris Ruffalo <cruffalo>
Component: AutomateAssignee: William Fitzgerald <wfitzger>
Status: CLOSED DUPLICATE QA Contact: Satyajit Bulage <sbulage>
Severity: low Docs Contact: Red Hat CloudForms Documentation <cloudforms-docs>
Priority: low    
Version: 5.9.9CC: cmatthew, dmetzger, gmccullo, mkanoor, mshriver, obarenbo, tfitzger
Target Milestone: GA   
Target Release: cfme-future   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2019-06-06 21:11:37 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: CFME Core Target Upstream Version:
Embargoed:
Attachments:
Description Flags
null coalescing 1
none
null coalescing workaround none

Description Chris Ruffalo 2019-04-04 11:20:08 UTC
Description of problem:
Null coalescing fields do not work as input to Ansible Playbook method.


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


How reproducible:
I have only encountered it in one test workflow but I believe it would be the same for all Ansible Playbook Methods


Steps to Reproduce:
1. Create a playbook that outputs a method parameter, say `input_field`
2. Create a playbook method that uses `${/#input_field} || "default"` as a method parameter
3. Simulate method execution with input_field = "new value"
4. Observe the output is 'new value || "default"'

Alternate Steps:
1. Import https://github.com/chrisruffalo/cfme-null-coalesce-issue.git as an Ansible repository with the EXACT name "CFME Null Coalesce Issue"
2. Import https://github.com/chrisruffalo/cfme-null-coalesce-issue.git as a Domain from the branch origin/master
3. Simulate the execution of `NullCoalesceAnsible` with the attribute/value pair { input_field => new value }
4. Observe the output of input_field is 'new value || "default"'
5. For comparison observe the output of input_field2 which is null coalesced in the instance


Actual results:
Null coalescing field has all non-null options

Expected results:
Null coalescing field should only have non-null options

Additional info:
https://github.com/chrisruffalo/cfme-null-coalesce-issue

Comment 2 William Fitzgerald 2019-04-11 17:57:25 UTC
Chris,

Null Coalescing fields don't work as input Parameters for Ansible methods and inline methods currently.
I opened a new BZ for this: https://bugzilla.redhat.com/show_bug.cgi?id=1698184

As a workaround, you can setup the null coalescing field in the instance and then use that in the input parameters.

I am going to include a couple of screenshots.  If you want, I have a domain export that I can include that has the workaround
included for both inline method and ansible method.

Thanks

Billy

Comment 3 William Fitzgerald 2019-04-11 17:58:25 UTC
Created attachment 1554615 [details]
null coalescing 1

Comment 4 William Fitzgerald 2019-04-11 17:59:20 UTC
Created attachment 1554616 [details]
null coalescing workaround

Comment 5 Chris Ruffalo 2019-04-12 01:45:57 UTC
Billy,

Thanks for taking the time to respond. In the domain I linked in the GitHub repository the difference is demonstrated with the different variables/values. I have a null coalescing field in the instance and then use the same pattern to null coalesce in the method parameter.

I'm using the workaround now but it diminishes the value of the shared code and being able to call it from anywhere because I've got to modify schemas where I have this issue. (I'm making drop-in replacements for existing automation from Embedded Ansible.)

Also, thank you for taking the time to test it with a Ruby method which I hadn't done in my domain.

Chris

Comment 6 William Fitzgerald 2019-04-12 19:54:37 UTC
Chris,

Are you ok with me marking this BZ as a duplicate of mine and closing it ?
I will track this issue for both cases with my BZ : https://bugzilla.redhat.com/show_bug.cgi?id=1698184

Please let me know

Comment 7 Tina Fitzgerald 2019-06-06 21:11:37 UTC

*** This bug has been marked as a duplicate of bug 1698184 ***

Comment 8 Red Hat Bugzilla 2023-09-14 05:26:30 UTC
The needinfo request[s] on this closed bug have been removed as they have been unresolved for 1000 days