Fix galaxy url use everywhere when url is set in config. (#63286)

In addition to trying the configured url (for ex, a migrated
'https://galaxy.ansible.com/') there is an attempt at that
URL with '/api' postpended.

If the extended URL works, update GalaxyAPI.api_server to
use the extended URL. Previously it only used it for finding
the API root info ('available_versions', etc)
pull/62438/head
Adrian Likins 5 years ago committed by Sam Doran
parent 5349b3ae4c
commit ed203c5902

@ -57,6 +57,10 @@ def g_connect(versions):
raise AnsibleError("Tried to find galaxy API root at %s but no 'available_versions' are available on %s" raise AnsibleError("Tried to find galaxy API root at %s but no 'available_versions' are available on %s"
% (n_url, self.api_server)) % (n_url, self.api_server))
# Update api_server to point to the "real" API root, which in this case
# was the configured url + '/api/' appended.
self.api_server = n_url
# Default to only supporting v1, if only v1 is returned we also assume that v2 is available even though # Default to only supporting v1, if only v1 is returned we also assume that v2 is available even though
# it isn't returned in the available_versions dict. # it isn't returned in the available_versions dict.
available_versions = data.get('available_versions', {u'v1': u'v1/'}) available_versions = data.get('available_versions', {u'v1': u'v1/'})

Loading…
Cancel
Save