-
Notifications
You must be signed in to change notification settings - Fork 3.4k
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
use optional api prefix in collection if set as environ vairable #15205
Conversation
I like this method as it leaves us open in the future to add other vars. LGTM! |
Also will the API be referenceable as a variable in the collection itself? |
@chadmf not sure what you mean. These changes are to a base class |
Ah yeah sorry my brain went straight to the collection |
I'm just a little surprised, why would we only respect this only as an environment variable as opposed to treating it as a config variable like all the others (like host, username, verify_ssl, etc.), which can also be given as environment vars. |
Updated the logic to detect if run using upstream awx or downstream controller. There was a variable called self._COLLECTION_TYPE that is used to determine what the collection type and is set at build time. awx/awx_collection/tools/roles/template_galaxy/tasks/main.yml Lines 17 to 21 in 0d4f653
Tested it out by changing this line
PTAL |
0e6c52b
to
31b0aec
Compare
…ible#15205) * use optional api prefix if set as environ variable * Different default depending on collection type
…ible#15205) * use optional api prefix if set as environ variable * Different default depending on collection type
SUMMARY
This change make the collection compatible with OPTIONAL_API_URLPATTERN_PREFIX environment variable.
ISSUE TYPE
COMPONENT NAME
ADDITIONAL INFORMATION
Testing:
To test this change I cloned the awx repo, made the change in the controller_api.py file and created a basic ansible playbook which references the updated awx code. The playbook launches a job against the controller. The playbook looks like this:
to run the playbook i ran the following command:
ansible-playbook -i localhost, play.yml -e ansible_connection=local