[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 commiteb6839a702
) (cherry picked from commit1233ce3797
)
This commit is contained in:
parent
88c1231e4d
commit
c3195685be
|
@ -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):
|
||||
|
|
Loading…
Reference in New Issue