From ed203c5902548c53798373817b6bb9de34ead9a9 Mon Sep 17 00:00:00 2001 From: Adrian Likins Date: Wed, 9 Oct 2019 16:24:46 -0400 Subject: [PATCH] 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) --- lib/ansible/galaxy/api.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/ansible/galaxy/api.py b/lib/ansible/galaxy/api.py index 6de310c33c1..47caedd1ee1 100644 --- a/lib/ansible/galaxy/api.py +++ b/lib/ansible/galaxy/api.py @@ -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" % (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 # it isn't returned in the available_versions dict. available_versions = data.get('available_versions', {u'v1': u'v1/'})