awx
awx copied to clipboard
Fix extra_vars format and empty value case
SUMMARY
For modules inventory, inventory_soruce, group, host and job_template fixed variable, extra_vars and source_vars parameters so that modules while expecting dictionary as an input push values in yaml format into AAP
Also, fixed edge case when user supplies empty dictionary so that yaml value being pushed into AAP is '---'
related #14918 #14842
ISSUE TYPE
- Bug, Docs Fix or other nominal change
COMPONENT NAME
- Collection
AWX VERSION
4.5.2
ADDITIONAL INFORMATION
Suggested testing. (01) Create required objects with no variables/extra_vars (02) Run the following (or similar) tasks
tasks:
- ansible.controller.inventory:
name: "Dynamic A"
organization: "A"
variables: {tt: tt, aa: aa}
- ansible.controller.host:
name: "Host A"
inventory: "Static A"
variables: {tt: tt, aa: aa}
- ansible.controller.group:
name: "Group A"
inventory: "Static A"
variables: {tt: tt, aa: aa}
- ansible.controller.job_template:
name: "A"
extra_vars: {tt: tt, aa: aa}
- ansible.controller.inventory_source:
name: "A"
inventory: "Dynamic A"
source_vars: {tt: tt, aa: aa}
(03) Make sure that variables/extra_vars show right values and formatting in both yaml and json (04) Run the following:
tasks:
- ansible.controller.inventory:
name: "Dynamic A"
organization: "A"
variables: {}
- ansible.controller.host:
name: "Host A"
inventory: "Static A"
variables: {}
- ansible.controller.group:
name: "Group A"
inventory: "Static A"
variables: {}
- ansible.controller.job_template:
name: "A"
extra_vars: {}
- ansible.controller.inventory_source:
name: "A"
inventory: "Dynamic A"
source_vars: {}
(05) Make sure that variables/extra_vars show right values and formatting in both yaml (---) and json ({})