mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-06-01 05:49:09 -07:00
Galaxy 2.0
This commit is contained in:
parent
0719eb3e2d
commit
4f84769a17
11 changed files with 949 additions and 112 deletions
|
@ -46,7 +46,7 @@ class GalaxyRole(object):
|
|||
SUPPORTED_SCMS = set(['git', 'hg'])
|
||||
META_MAIN = os.path.join('meta', 'main.yml')
|
||||
META_INSTALL = os.path.join('meta', '.galaxy_install_info')
|
||||
ROLE_DIRS = ('defaults','files','handlers','meta','tasks','templates','vars')
|
||||
ROLE_DIRS = ('defaults','files','handlers','meta','tasks','templates','vars','tests')
|
||||
|
||||
|
||||
def __init__(self, galaxy, name, src=None, version=None, scm=None, path=None):
|
||||
|
@ -198,10 +198,10 @@ class GalaxyRole(object):
|
|||
role_data = self.src
|
||||
tmp_file = self.fetch(role_data)
|
||||
else:
|
||||
api = GalaxyAPI(self.galaxy, self.options.api_server)
|
||||
api = GalaxyAPI(self.galaxy)
|
||||
role_data = api.lookup_role_by_name(self.src)
|
||||
if not role_data:
|
||||
raise AnsibleError("- sorry, %s was not found on %s." % (self.src, self.options.api_server))
|
||||
raise AnsibleError("- sorry, %s was not found on %s." % (self.src, api.api_server))
|
||||
|
||||
role_versions = api.fetch_role_related('versions', role_data['id'])
|
||||
if not self.version:
|
||||
|
@ -213,8 +213,10 @@ class GalaxyRole(object):
|
|||
loose_versions = [LooseVersion(a.get('name',None)) for a in role_versions]
|
||||
loose_versions.sort()
|
||||
self.version = str(loose_versions[-1])
|
||||
elif role_data.get('github_branch', None):
|
||||
self.version = role_data['github_branch']
|
||||
else:
|
||||
self.version = 'master'
|
||||
self.version = 'master'
|
||||
elif self.version != 'master':
|
||||
if role_versions and self.version not in [a.get('name', None) for a in role_versions]:
|
||||
raise AnsibleError("- the specified version (%s) of %s was not found in the list of available versions (%s)." % (self.version, self.name, role_versions))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue