[Validator Show] Properly throwing an exception for unknown validation

When running validator show subcommand with a non-existing validation,
the subcommand was outputting multiple tracebacks instead of giving a
simple message to the user.

The patch adds a proper management result when displaying informations
of a non-existing validation.

Change-Id: If7ef6eb53fe1de66a3a21424ed4e64318e680dd0
Signed-off-by: Gael Chamoulaud (Strider) <gchamoul@redhat.com>
(cherry picked from commit eb6839a702)
(cherry picked from commit 1233ce3797)
This commit is contained in:
Gael Chamoulaud (Strider) 2020-10-19 12:43:48 +02:00 committed by mbu
parent 88c1231e4d
commit c3195685be
1 changed files with 6 additions and 4 deletions

View File

@ -94,13 +94,15 @@ class TripleOValidatorShow(command.ShowOne):
def take_action(self, parsed_args):
LOG.debug(_('Show validation result'))
actions = ValidationActions(constants.ANSIBLE_VALIDATION_DIR)
try:
actions = ValidationActions(constants.ANSIBLE_VALIDATION_DIR)
data = actions.show_validations(parsed_args.validation_id)
return data.keys(), data.values()
except Exception as e:
raise RuntimeError(_("Validations listing finished with errors\n"
"Output: {}").format(e))
raise exceptions.CommandError(e)
if data:
return data.keys(), data.values()
class TripleOValidatorShowParameter(command.Command):