[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
)
This commit is contained in:
parent
f4f5c7f0d4
commit
1233ce3797
|
@ -93,13 +93,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