Skip to content

Commit

Permalink
Print error messages if qubes.TemplateSearch fails.
Browse files Browse the repository at this point in the history
  • Loading branch information
WillyPillow committed Jul 29, 2020
1 parent e6392ba commit 37a72ec
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions qubesadmin/tools/qvm_template.py
Original file line number Diff line number Diff line change
Expand Up @@ -260,6 +260,7 @@ def qrexec_popen(args, app, service, stdout=subprocess.PIPE, filter_esc=True):
stderr=subprocess.PIPE)

def qrexec_payload(args, app, spec):
# TODO: Support for force-refresh
_ = app # unused

def check_newline(string, name):
Expand Down Expand Up @@ -288,13 +289,13 @@ def check_newline(string, name):
return payload

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')
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')
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.")
result = []
for line in stdout.strip().split('\n'):
Expand Down

0 comments on commit 37a72ec

Please sign in to comment.