qvm-template: improve error reporting

Do not print the whole traceback by default - do that only when
--verbose is used.
This commit is contained in:
Marek Marczykowski-Górecki 2021-02-06 07:31:37 +01:00
parent 8795668233
commit ce36dc55c5
No known key found for this signature in database
GPG Key ID: 063938BA42CFA724

View File

@ -1477,6 +1477,7 @@ def main(args: typing.Optional[typing.Sequence[str]] = None,
if p_args.updatevm is UPDATEVM: if p_args.updatevm is UPDATEVM:
p_args.updatevm = app.updatevm p_args.updatevm = app.updatevm
try:
if p_args.refresh: if p_args.refresh:
qrexec_repoquery(p_args, app, refresh=True) qrexec_repoquery(p_args, app, refresh=True)
@ -1509,6 +1510,10 @@ def main(args: typing.Optional[typing.Sequence[str]] = None,
repolist(p_args, app) repolist(p_args, app)
else: else:
parser.error('Command \'%s\' not supported.' % p_args.command) parser.error('Command \'%s\' not supported.' % p_args.command)
except Exception as e: # pylint: disable=broad-except
print('ERROR: ' + str(e), file=sys.stderr)
app.log.debug(str(e), exc_info=sys.exc_info())
return 1
return 0 return 0