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:
parent
8795668233
commit
ce36dc55c5
@ -1477,38 +1477,43 @@ 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
|
||||||
|
|
||||||
if p_args.refresh:
|
try:
|
||||||
qrexec_repoquery(p_args, app, refresh=True)
|
if p_args.refresh:
|
||||||
|
qrexec_repoquery(p_args, app, refresh=True)
|
||||||
|
|
||||||
if p_args.command == 'download':
|
if p_args.command == 'download':
|
||||||
download(p_args, app)
|
download(p_args, app)
|
||||||
elif p_args.command == 'install':
|
elif p_args.command == 'install':
|
||||||
install(p_args, app)
|
install(p_args, app)
|
||||||
elif p_args.command == 'reinstall':
|
elif p_args.command == 'reinstall':
|
||||||
install(p_args, app, version_selector=VersionSelector.REINSTALL,
|
install(p_args, app, version_selector=VersionSelector.REINSTALL,
|
||||||
override_existing=True)
|
override_existing=True)
|
||||||
elif p_args.command == 'downgrade':
|
elif p_args.command == 'downgrade':
|
||||||
install(p_args, app, version_selector=VersionSelector.LATEST_LOWER,
|
install(p_args, app, version_selector=VersionSelector.LATEST_LOWER,
|
||||||
override_existing=True)
|
override_existing=True)
|
||||||
elif p_args.command == 'upgrade':
|
elif p_args.command == 'upgrade':
|
||||||
install(p_args, app, version_selector=VersionSelector.LATEST_HIGHER,
|
install(p_args, app, version_selector=VersionSelector.LATEST_HIGHER,
|
||||||
override_existing=True)
|
override_existing=True)
|
||||||
elif p_args.command == 'list':
|
elif p_args.command == 'list':
|
||||||
list_templates(p_args, app, 'list')
|
list_templates(p_args, app, 'list')
|
||||||
elif p_args.command == 'info':
|
elif p_args.command == 'info':
|
||||||
list_templates(p_args, app, 'info')
|
list_templates(p_args, app, 'info')
|
||||||
elif p_args.command == 'search':
|
elif p_args.command == 'search':
|
||||||
search(p_args, app)
|
search(p_args, app)
|
||||||
elif p_args.command == 'remove':
|
elif p_args.command == 'remove':
|
||||||
remove(p_args, app, disassoc=p_args.disassoc)
|
remove(p_args, app, disassoc=p_args.disassoc)
|
||||||
elif p_args.command == 'purge':
|
elif p_args.command == 'purge':
|
||||||
remove(p_args, app, purge=True)
|
remove(p_args, app, purge=True)
|
||||||
elif p_args.command == 'clean':
|
elif p_args.command == 'clean':
|
||||||
clean(p_args, app)
|
clean(p_args, app)
|
||||||
elif p_args.command == 'repolist':
|
elif p_args.command == 'repolist':
|
||||||
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
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user