ManageIQ / manageiq-automation_engine

Automation engine for ManageIQ
Apache License 2.0
11 stars 73 forks source link

Fix automation array values #545

Closed GilbertCherrie closed 2 months ago

GilbertCherrie commented 4 months ago

Fixed automation array values for multi select drop downs in Order Service Forms.

When ordering from a Service Catalog for an Ansible Playbook Catalog Item there is a bug with multi-select dropdown values not being correctly sent to the Ansible Playbook.

An example order service form with a multi-select dropdown:

Screenshot 2024-04-22 at 3 38 28 PM

Before: When viewing the Ansible Playbook output in the Services / My Services Screen for the Service you order will look like this. test1 is the multi-select dropdown value and it outputs "VARIABLE IS NOT DEFINED!". test2 is just a single select dropdown used for reference.

Screenshot 2024-04-22 at 3 38 11 PM

This is due to the field being with "Array::" on its key value causing the Ansible Playbook output to not be able to find that variable. When the "Array::" tag is removed from the key it then displays the Array as a String with \u001f separating the Array items.

Screenshot 2024-04-22 at 3 47 51 PM

After: By removing the "Array::" tag from the variable key as well as converting the value being sent to the Ansible Playbook from a String to an Array we receive the Array in the Playbook and see it on the Playbook output correctly. This allows us to send Arrays to the Ansible Playbook and view it correctly on the output screen as individual items instead of as a String.

Screenshot 2024-04-22 at 3 30 43 PM
GilbertCherrie commented 3 months ago

Need a ui fix for this: https://github.com/ManageIQ/manageiq-ui-classic/commit/3cdd0071706173fdc6b55858b985bd614f6dc362

miq-bot commented 2 months ago

Checked commits https://github.com/GilbertCherrie/manageiq-automation_engine/compare/a81de65f9b45716f6c39dd9d336c04db08a2a80c~...c54ce453e6c99bbbc18d22125a63cded11cf2981 with ruby 3.1.5, rubocop 1.56.3, haml-lint 0.51.0, and yamllint 3 files checked, 1 offense detected

lib/miq_automation_engine/engine/miq_ae_engine/miq_ae_object.rb

Fryguy commented 2 months ago

Backported to radjabov in commit f74123ed477ea5da5ef995ce33a8cc0f1b270bdc.

commit f74123ed477ea5da5ef995ce33a8cc0f1b270bdc
Author: Jason Frey <fryguy9@gmail.com>
Date:   Fri Jun 28 17:12:11 2024 -0400

    Merge pull request #545 from GilbertCherrie/fix_automation_arrays

    Fix automation array values

    (cherry picked from commit 7707684565508d02dcc2345b4f706c0f885ea620)