Fetching collections from private Artifactory: KeyError: 'results'

Dear all,

I am currently trying to get a AWX instance to update the collections not from the public ansible galaxy, but from an Artifactory instance in our environment.

I can pull the collections from Artifactory locally, so it works in general.

We are building our own execution environment image, which is also pulling the collections from Artifactory successfully.

  prepend_galaxy:
    - ENV ANSIBLE_GALAXY_SERVER_LIST=ext_ansible_galaxy_remote
    - ENV ANSIBLE_GALAXY_SERVER_EXT_ANSIBLE_GALAXY_REMOTE_URL=https://artifactory.example.org/...

However, when trying to get the collection update (during a project update in AWX) to update from Artifactory, we get the following error:

[WARNING]: Skipping Galaxy server
https://artifactory.example.org/
Got an unexpected error when getting available versions of collection
community.hashi_vault: 'results'
ERROR! Unexpected Exception, this is probably a bug: 'results'

To use Artifactory, we have created a AWX credential of type “Ansible Galaxy” with the URL of Artifactory set.
We had to disable the TLS certificate validation for collection updates (I’ll open a separate post for that).

The actual python error looks like this:

Traceback (most recent call last):
  File "/usr/local/lib/python3.13/site-packages/ansible/galaxy/api.py", line 93, in wrapped
    data = self._call_galaxy(n_url, method='GET', error_context_msg=error_context_msg, cache=True)
  File "/usr/local/lib/python3.13/site-packages/ansible/module_utils/api.py", line 169, in run_function
    return call_retryable_function()
  File "/usr/local/lib/python3.13/site-packages/ansible/galaxy/api.py", line 389, in _call_galaxy
    res = path_cache['results']
          ~~~~~~~~~~^^^^^^^^^^^
KeyError: 'results'

The collections can be fetched locally without authentication to Artifactory, but we have also tried to add a token to the Galaxy-type credential. No change in the error.

The execution environment image used for the controlplane is self-built to have a recent Ansible included (2.18.10).

Any ideas, anyone?

Kind Regards,
Johannes

This was also reported as a bug Unexpected Exception, this is probably a bug: 'results' · Issue #85918 · ansible/ansible · GitHub. The error handling should be a little better now on devel, and give clues as to what is actually in the cache. You can work around the issue with --no-cache.

Thanks for the reply and the bug report. How would I use --no-cache in AWX during the collections update?

You can add ansible-galaxy CLI args in the execution environment:

build_arg_defaults:
  ANSIBLE_GALAXY_CLI_COLLECTION_OPTS: '--no-cache'