Allow using galaxy.yml as a requirements file

pull/72637/head
Matt Martz 4 years ago
parent 85570e2dc0
commit 327c9f53ef
No known key found for this signature in database
GPG Key ID: 40832D88E9FC91D8

@ -608,8 +608,9 @@ class GalaxyCLI(CLI):
else:
# Newer format with a collections and/or roles key
extra_keys = set(file_requirements.keys()).difference(set(['roles', 'collections']))
if extra_keys:
is_galaxy_yml = set(file_requirements.keys()).issuperset(['name', 'namespace'])
extra_keys = set(file_requirements.keys()).difference(['roles', 'collections'])
if extra_keys and not is_galaxy_yml:
raise AnsibleError("Expecting only 'roles' and/or 'collections' as base keys in the requirements "
"file. Found: %s" % (to_native(", ".join(extra_keys))))
@ -641,6 +642,10 @@ class GalaxyCLI(CLI):
else:
requirements['collections'].append((collection_req, '*', None, None))
if is_galaxy_yml:
for req_name, req_version in (file_requirements.get('dependencies') or {}).items():
requirements['collections'].append((req_name, req_version, None, None))
return requirements
@staticmethod

Loading…
Cancel
Save