mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-05-07 05:42:50 +00:00
now galaxy correctly detects empty requirements file
also allow for 'scm' and 'src' not to be populated in requirements entries
This commit is contained in:
@@ -310,7 +310,15 @@ class GalaxyCLI(CLI):
|
||||
try:
|
||||
f = open(role_file, 'r')
|
||||
if role_file.endswith('.yaml') or role_file.endswith('.yml'):
|
||||
for role in yaml.safe_load(f.read()):
|
||||
try:
|
||||
required_roles = yaml.safe_load(f.read())
|
||||
except Exception as e:
|
||||
raise AnsibleError("Unable to load data from the requirements file: %s" % role_file)
|
||||
|
||||
if required_roles is None:
|
||||
raise AnsibleError("No roles found in file: %s" % role_file)
|
||||
|
||||
for role in required_roles:
|
||||
role = RoleRequirement.role_yaml_parse(role)
|
||||
self.display.debug('found role %s in yaml file' % str(role))
|
||||
if 'name' not in role and 'scm' not in role:
|
||||
|
||||
Reference in New Issue
Block a user