Add an error message when groups is not found in the playbook

If there are no groups in the playbook, we currently get a python error
when running command 'openstack tripleo validator group info'

Change-Id: Ice089c33d566e90bea55e18fe7f77f9d33fe81f3
This commit is contained in:
Owen McGonagle 2021-01-27 13:17:57 -05:00
parent 528c44b4e7
commit e21f6f11f8
1 changed files with 4 additions and 0 deletions

View File

@ -88,6 +88,10 @@ def parse_all_validations_on_disk(path, groups=None):
for pl in validations_abspath:
val = Validation(pl)
if not val.groups:
msg = 'Group not found in playbook - please add appropriate group'
raise RuntimeError(msg)
if not groups or set(groups).intersection(val.groups):
results.append(val.get_metadata)
return results