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

correct error message when calling tower_AWXKit collections module and venv doesn't have it #8308

Conversation

rebeccahhh
Copy link
Member

SUMMARY

relates to #8127 - The reason this issue arose in the first place is due to attempting to use an Ansible module (exit_json) when the correct one was instead fail_json. This triggered a different error message entirely, obfuscating from the venv's lack of correct set up. The logic of alerting if and when AWXKit was not present in a venv calling for it was already present within the module and now can be properly utilized.
Specifics:

  • code was originally supposed to be hitting this module, but instead was hitting this (and correctly so) due to it attempting to use unsupported parameters within the exit_json ansible module.
  • pertinent ansible documentation regarding exit_json vs. fail_json here
ISSUE TYPE
  • Bugfix Pull Request
COMPONENT NAME
  • API
  • Collections
AWX VERSION
awx: 14.1.0
ADDITIONAL INFORMATION

prior to change the error spit out would have been:

fatal: [localhost]: FAILED! => {"changed": false, "msg": "Unsupported parameters for (tower_export) module: inventory Supported parameters include: all, tower_config_file, tower_host, tower_oauthtoken, tower_password, tower_username, validate_certs"}

post change it should be:

fatal: [localhost]: FAILED! => {"changed": false, "msg": "Failed to import the required Python library (awxkit) on localhost.localdomain's Python /<path to venv>/bin/python3. Please read the module documentation and install it in the appropriate location. If the required library is installed, but Ansible is using the wrong Python interpreter, please consult the documentation on ansible_python_interpreter"}

… attempting to utilize the missing_required_lib from ansible. Additionally fixed it for the second usage for correct usage. Given that it is an exception the correct one would not be to exit without failure, as exit_json does, but instead to use fail_json and be able to present the error
@rebeccahhh rebeccahhh added the component:awx_collection issues related to the collection for controlling AWX label Oct 1, 2020
@rebeccahhh rebeccahhh requested a review from beeankha October 1, 2020 23:04
@rebeccahhh rebeccahhh self-assigned this Oct 1, 2020
@rebeccahhh rebeccahhh marked this pull request as draft October 1, 2020 23:04
@softwarefactory-project-zuul
Copy link
Contributor

Build succeeded.

Copy link
Contributor

@beeankha beeankha left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice catch! 👍

Copy link
Contributor

@squidboylan squidboylan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

WFM!

@rebeccahhh rebeccahhh marked this pull request as ready for review October 2, 2020 15:41
@softwarefactory-project-zuul
Copy link
Contributor

Build succeeded (gate pipeline).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component:awx_collection issues related to the collection for controlling AWX
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants