Force updating the container if flmcode/dangerzone image is not there, and show slightly more output when pulling the image

This commit is contained in:
Micah Lee 2020-02-27 15:44:13 -08:00
parent 68da5dda52
commit dd6c336b85
No known key found for this signature in database
GPG key ID: 403C2657CD994F73
2 changed files with 8 additions and 14 deletions

View file

@ -136,7 +136,7 @@ class SettingsWidget(QtWidgets.QWidget):
# Is update containers required?
output = subprocess.check_output(
[self.global_common.container_runtime, "image", "ls", "dangerzone"],
[self.global_common.container_runtime, "image", "ls", "flmcode/dangerzone"],
startupinfo=self.global_common.get_subprocess_startupinfo(),
)
if b"dangerzone" not in output:

View file

@ -15,7 +15,7 @@ class TaskBase(QtCore.QThread):
def __init__(self):
super(TaskBase, self).__init__()
def exec_container(self, args, watch="stdout"):
def exec_container(self, args):
args = [self.global_common.container_runtime] + args
args_str = " ".join(pipes.quote(s) for s in args)
@ -33,20 +33,12 @@ class TaskBase(QtCore.QThread):
universal_newlines=True,
startupinfo=self.global_common.get_subprocess_startupinfo(),
) as p:
if watch == "stdout":
pipe = p.stdout
else:
pipe = p.stderr
for line in pipe:
for line in p.stdout:
output += line
print(line, end="")
self.update_details.emit(output)
if watch == "stdout":
output += p.stderr.read()
else:
output += p.stdout.read()
self.update_details.emit(output)
return p.returncode, output
@ -59,10 +51,12 @@ class PullImageTask(TaskBase):
self.common = common
def run(self):
self.update_label.emit("Pulling container image")
self.update_label.emit(
"Pulling container image (this might take a few minutes)"
)
self.update_details.emit("")
args = ["pull", "flmcode/dangerzone"]
returncode, _ = self.exec_container(args, watch="stderr")
returncode, _ = self.exec_container(args)
if returncode != 0:
self.task_failed.emit(f"Return code: {returncode}")