Browse Source

[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>
changes/03/758803/3
Gael Chamoulaud (Strider) 6 months ago
parent
commit
87114686ae
No known key found for this signature in database GPG Key ID: 4119D0305C651D66
1 changed files with 11 additions and 3 deletions
  1. +11
    -3
      validations_libs/validation_actions.py

+ 11
- 3
validations_libs/validation_actions.py View File

@ -86,9 +86,17 @@ class ValidationActions(object):
playbooks = v_utils.get_validations_playbook(validations_dir,
validation_name,
group)
if not playbooks:
msg = "Validation {} not found in {}.".format(validation_name,
validations_dir)
if not playbooks or len(validation_name) != len(playbooks):
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)
else:
raise RuntimeError("No validations found")


Loading…
Cancel
Save