[Validator Run] Detect unknown validations from the command-line
When executing multiple validations with at least one unknown validation, the CLI was executing only the existing ones but was not informing the user that he/she typed one or more wrong validations. This patch fixes that issue by detecting which validations are wrong and inform the user. Depends-On: https://review.opendev.org/758821 Change-Id: I4910043df07f32539793a2bc464377603fe2b02f Signed-off-by: Gael Chamoulaud (Strider) <gchamoul@redhat.com>
This commit is contained in:
parent
96cf2f27c2
commit
87114686ae
|
@ -86,9 +86,17 @@ class ValidationActions(object):
|
||||||
playbooks = v_utils.get_validations_playbook(validations_dir,
|
playbooks = v_utils.get_validations_playbook(validations_dir,
|
||||||
validation_name,
|
validation_name,
|
||||||
group)
|
group)
|
||||||
if not playbooks:
|
|
||||||
msg = "Validation {} not found in {}.".format(validation_name,
|
if not playbooks or len(validation_name) != len(playbooks):
|
||||||
validations_dir)
|
p = []
|
||||||
|
for play in playbooks:
|
||||||
|
p.append(os.path.basename(os.path.splitext(play)[0]))
|
||||||
|
|
||||||
|
unknown_validation = list(set(validation_name) - set(p))
|
||||||
|
|
||||||
|
msg = "Validation {} not found in {}.".format(
|
||||||
|
unknown_validation, validations_dir)
|
||||||
|
|
||||||
raise RuntimeError(msg)
|
raise RuntimeError(msg)
|
||||||
else:
|
else:
|
||||||
raise RuntimeError("No validations found")
|
raise RuntimeError("No validations found")
|
||||||
|
|
Loading…
Reference in New Issue