qvm-template: Defer qrexec calls so that they can be omitted if exceptions are raised.
This commit is contained in:
parent
e482b9eb0f
commit
69cd285810
@ -275,8 +275,8 @@ def qrexec_payload(args, app, spec, refresh):
|
|||||||
return payload
|
return payload
|
||||||
|
|
||||||
def qrexec_repoquery(args, app, spec='*', refresh=False):
|
def qrexec_repoquery(args, app, spec='*', refresh=False):
|
||||||
proc = qrexec_popen(args, app, 'qubes.TemplateSearch')
|
|
||||||
payload = qrexec_payload(args, app, spec, refresh)
|
payload = qrexec_payload(args, app, spec, refresh)
|
||||||
|
proc = qrexec_popen(args, app, 'qubes.TemplateSearch')
|
||||||
stdout, stderr = 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:
|
||||||
@ -335,10 +335,10 @@ def qrexec_repoquery(args, app, spec='*', refresh=False):
|
|||||||
|
|
||||||
def qrexec_download(args, app, spec, path, dlsize=None, refresh=False):
|
def qrexec_download(args, app, spec, path, dlsize=None, refresh=False):
|
||||||
with open(path, 'wb') as fd:
|
with open(path, 'wb') as fd:
|
||||||
|
payload = qrexec_payload(args, app, spec, refresh)
|
||||||
# Don't filter ESCs for binary files
|
# Don't filter ESCs for binary files
|
||||||
proc = qrexec_popen(args, app, 'qubes.TemplateDownload',
|
proc = qrexec_popen(args, app, 'qubes.TemplateDownload',
|
||||||
stdout=fd, filter_esc=False)
|
stdout=fd, filter_esc=False)
|
||||||
payload = qrexec_payload(args, app, spec, refresh)
|
|
||||||
proc.stdin.write(payload.encode('UTF-8'))
|
proc.stdin.write(payload.encode('UTF-8'))
|
||||||
proc.stdin.close()
|
proc.stdin.close()
|
||||||
with tqdm.tqdm(desc=spec, total=dlsize, unit_scale=True,
|
with tqdm.tqdm(desc=spec, total=dlsize, unit_scale=True,
|
||||||
|
Loading…
Reference in New Issue
Block a user