Print error messages if qubes.TemplateSearch fails.
This commit is contained in:
parent
e6392ba4ec
commit
37a72ecebf
@ -260,6 +260,7 @@ def qrexec_popen(args, app, service, stdout=subprocess.PIPE, filter_esc=True):
|
|||||||
stderr=subprocess.PIPE)
|
stderr=subprocess.PIPE)
|
||||||
|
|
||||||
def qrexec_payload(args, app, spec):
|
def qrexec_payload(args, app, spec):
|
||||||
|
# TODO: Support for force-refresh
|
||||||
_ = app # unused
|
_ = app # unused
|
||||||
|
|
||||||
def check_newline(string, name):
|
def check_newline(string, name):
|
||||||
@ -288,13 +289,13 @@ def qrexec_payload(args, app, spec):
|
|||||||
return payload
|
return payload
|
||||||
|
|
||||||
def qrexec_repoquery(args, app, spec='*'):
|
def qrexec_repoquery(args, app, spec='*'):
|
||||||
# TODO: Perhaps expose stderr for error messages?
|
|
||||||
# At least need to provide message that, e.g., repoid does not exist.
|
|
||||||
proc = qrexec_popen(args, app, 'qubes.TemplateSearch')
|
proc = qrexec_popen(args, app, 'qubes.TemplateSearch')
|
||||||
payload = qrexec_payload(args, app, spec)
|
payload = qrexec_payload(args, app, spec)
|
||||||
stdout, _ = proc.communicate(payload.encode('UTF-8'))
|
stdout, stderr = proc.communicate(payload.encode('UTF-8'))
|
||||||
stdout = stdout.decode('ASCII')
|
stdout = stdout.decode('ASCII')
|
||||||
if proc.wait() != 0:
|
if proc.wait() != 0:
|
||||||
|
for line in stderr.decode('ASCII').rstrip().split('\n'):
|
||||||
|
print('[Qrexec] %s' % line, file=sys.stderr)
|
||||||
raise ConnectionError("qrexec call 'qubes.TemplateSearch' failed.")
|
raise ConnectionError("qrexec call 'qubes.TemplateSearch' failed.")
|
||||||
result = []
|
result = []
|
||||||
for line in stdout.strip().split('\n'):
|
for line in stdout.strip().split('\n'):
|
||||||
|
Loading…
Reference in New Issue
Block a user