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 verbosity parameter choices for ad_hoc_command module #13379

Merged
merged 1 commit into from
Jan 31, 2023

Conversation

OscarBell
Copy link

Signed-off-by: Oscar oscar.bell@bell.local

SUMMARY

Fix for #13377

The verbosity parameter can't be used because the choices list in the module_args definition refers to strings instead of the required integer values. This pull request updates the choices list to an integer list which makes it possible to change the verbosity parameter.

When trying to change the verbosity parameter with the original module Ansible complains with an error message

fatal: [localhost]: FAILED! => {"changed": false, "msg": "value of verbosity must be one of: 0, 1, 2, 3, 4, 5, got: 2"}
ISSUE TYPE
  • Bug, Docs Fix or other nominal change
COMPONENT NAME
  • Collection
AWX VERSION
21.10.2
ADDITIONAL INFORMATION

To reproduce the bug add the verbosity parameter to the ad_hoc_command module call.

    - name: Execute ad_hoc command via awx collection
      awx.awx.ad_hoc_command:
        controller_host: "{{ controller_host }}"
        controller_username: "{{ controller_username }}"
        controller_password: "{{ controller_password }}"
        credential: "{{ credential_id }}"
        inventory: "{{ inventory_id }}"
        module_name: command
        module_args: hostname
        limit: "{{ limit_host }}"
        verbosity: 2
        wait: true
      register: ad_hoc_command_result

This will result in an Ansible validation error like below.

fatal: [localhost]: FAILED! => {"changed": false, "msg": "value of verbosity must be one of: 0, 1, 2, 3, 4, 5, got: 2"}

After the change in the module code the ad_hoc_command is started on the AWX host and in the output and details of the job we can see the verbosity level being set to 2.

@github-actions github-actions bot added component:awx_collection issues related to the collection for controlling AWX community labels Dec 26, 2022
@TheRealHaoLiu
Copy link
Member

TheRealHaoLiu commented Jan 25, 2023

re-kicked off the CI check hopefully the failure are just a flake

enabled auto merge if the CI passes

@TheRealHaoLiu
Copy link
Member

@OscarBell congratulations for your FIRST contribution to the AWX project

come join us in our chatroom on Matrix https://matrix.to/#/#awx:ansible.com

@TheRealHaoLiu TheRealHaoLiu changed the title 13377: Choices list for verbosity parameter should be a list of integers Fix verbosity parameter choices for ad_hoc_command module Jan 25, 2023
@TheRealHaoLiu
Copy link
Member

I also updated your PR title to be more descriptive. We use the PR title when we generate the change log

@TheRealHaoLiu
Copy link
Member

@OscarBell the test failure does not seem to be related to your PR, can you rebase your PR against devel and see if that fixes the test failure? Thanks

@OscarBell
Copy link
Author

@TheRealHaoLiu : I've rebased against devel branch and pushed the result.
Thanks for your comments and changing the title. Happy to be involved in improving the product.

@TheRealHaoLiu
Copy link
Member

@OscarBell thank you for your contribution and congratulation for your first contribution to AWX 🎊

Come hang out with us on AWX Matrix chatroom https://matrix.to/#/#awx:ansible.com

Also I added a shout out to you on our next Community meeting agenda #13431

@TheRealHaoLiu TheRealHaoLiu merged commit 6483575 into ansible:devel Jan 31, 2023
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