Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix extra_vars format and empty value case #15232

Open
wants to merge 3 commits into
base: devel
Choose a base branch
from

Conversation

kk-at-redhat
Copy link

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 ({})

@github-actions github-actions bot added component:awx_collection issues related to the collection for controlling AWX community labels May 27, 2024
@fosterseth
Copy link
Member

more broadly, is this a problem on awx api side, or unique to awx collection? i.e. even with these changes, is this still an issue with curl/awxkit

@tvo318
Copy link
Member

tvo318 commented Jun 5, 2024

@kk-at-redhat
Copy link
Author

Thank you. I think that awx_collection errors are expected since this is what the change is about.

@fosterseth as far as I can see API expects yaml, so that's what we should give it through the collection.
If API should be expecting yaml or json - that's outside of the scope IMHO.

@tvo318 tvo318 requested a review from fosterseth June 10, 2024 15:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
community component:awx_collection issues related to the collection for controlling AWX
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants