1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

Allow the galaxy client to fetch from a url in role version data (#39396)

Currently if the ansible-galaxy client fetches a role from a galaxy
server, it then fetches the role from Github. This change allows a
galaxy server to provide an alternate source url that points to an
archive that contains the role version.
This commit is contained in:
David Davis 2018-04-30 16:47:43 -04:00 committed by Adam Miller
parent c0043444c9
commit 2d21c7da17
2 changed files with 7 additions and 2 deletions

View file

@ -203,7 +203,7 @@ class GalaxyAPI(object):
"""
try:
url = '%s/roles/%d/%s/?page_size=50' % (self.baseurl, int(role_id), related)
url = '%s/roles/%s/%s/?page_size=50' % (self.baseurl, role_id, related)
data = self.__call_galaxy(url)
results = data['results']
done = (data.get('next_link', None) is None)

View file

@ -167,7 +167,7 @@ class GalaxyRole(object):
def fetch(self, role_data):
"""
Downloads the archived role from github to a temp location
Downloads the archived role to a temp location based on role data
"""
if role_data:
@ -242,6 +242,11 @@ class GalaxyRole(object):
self.name,
role_versions))
# check if there's a source link for our role_version
for role_version in role_versions:
if role_version['name'] == self.version and 'source' in role_version:
self.src = role_version['source']
tmp_file = self.fetch(role_data)
else: