How to resolve the "AttributeError: 'Api' object has no attribute 'available_versions' error" in Ansible Automation Platform 2.5?
Environment
- Red Hat Ansible Automation Platform 2.5
Issue
- In Ansible Automation Platform 2.5, awx cli utility command fails with an error
"AttributeError: 'Api' object has no attribute 'available_versions' error"
Resolution
-
Run the export for below variable at the cli before using the awx utility to manage the AAP infra:
$ export AWXKIT_API_BASE_PATH='/api/controller/'
Root Cause
- Without the variable the code points to the ${URL}/api endpoint, which is fine for the AAP controller 4.5 but in 4.6 the API endpoint has been moved under /api/controller/.
Diagnostic Steps
-
The following error traceback can be observed while running the awx command utility:
Traceback (most recent call last): File "/usr/lib/python3.11/site-packages/awxkit/cli/__init__.py", line 24, in run cli.connect() File "/usr/lib/python3.11/site-packages/awxkit/cli/client.py", line 123, in connect self.fetch_version_root() File "/usr/lib/python3.11/site-packages/awxkit/cli/client.py", line 138, in fetch_version_root raise RuntimeError('An error occurred while fetching {}/api/'.format(self.get_config('host'))) RuntimeError: An error occurred while fetching https://127.0.0.1/api/
This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.
Comments