mirror of
https://github.com/freedomofpress/dangerzone.git
synced 2025-04-29 02:12:36 +02:00
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:
parent
68da5dda52
commit
dd6c336b85
2 changed files with 8 additions and 14 deletions
|
@ -136,7 +136,7 @@ class SettingsWidget(QtWidgets.QWidget):
|
||||||
|
|
||||||
# Is update containers required?
|
# Is update containers required?
|
||||||
output = subprocess.check_output(
|
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(),
|
startupinfo=self.global_common.get_subprocess_startupinfo(),
|
||||||
)
|
)
|
||||||
if b"dangerzone" not in output:
|
if b"dangerzone" not in output:
|
||||||
|
|
|
@ -15,7 +15,7 @@ class TaskBase(QtCore.QThread):
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
super(TaskBase, self).__init__()
|
super(TaskBase, self).__init__()
|
||||||
|
|
||||||
def exec_container(self, args, watch="stdout"):
|
def exec_container(self, args):
|
||||||
args = [self.global_common.container_runtime] + args
|
args = [self.global_common.container_runtime] + args
|
||||||
args_str = " ".join(pipes.quote(s) for s in args)
|
args_str = " ".join(pipes.quote(s) for s in args)
|
||||||
|
|
||||||
|
@ -33,20 +33,12 @@ class TaskBase(QtCore.QThread):
|
||||||
universal_newlines=True,
|
universal_newlines=True,
|
||||||
startupinfo=self.global_common.get_subprocess_startupinfo(),
|
startupinfo=self.global_common.get_subprocess_startupinfo(),
|
||||||
) as p:
|
) as p:
|
||||||
if watch == "stdout":
|
for line in p.stdout:
|
||||||
pipe = p.stdout
|
|
||||||
else:
|
|
||||||
pipe = p.stderr
|
|
||||||
|
|
||||||
for line in pipe:
|
|
||||||
output += line
|
output += line
|
||||||
print(line, end="")
|
print(line, end="")
|
||||||
self.update_details.emit(output)
|
self.update_details.emit(output)
|
||||||
|
|
||||||
if watch == "stdout":
|
output += p.stderr.read()
|
||||||
output += p.stderr.read()
|
|
||||||
else:
|
|
||||||
output += p.stdout.read()
|
|
||||||
self.update_details.emit(output)
|
self.update_details.emit(output)
|
||||||
|
|
||||||
return p.returncode, output
|
return p.returncode, output
|
||||||
|
@ -59,10 +51,12 @@ class PullImageTask(TaskBase):
|
||||||
self.common = common
|
self.common = common
|
||||||
|
|
||||||
def run(self):
|
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("")
|
self.update_details.emit("")
|
||||||
args = ["pull", "flmcode/dangerzone"]
|
args = ["pull", "flmcode/dangerzone"]
|
||||||
returncode, _ = self.exec_container(args, watch="stderr")
|
returncode, _ = self.exec_container(args)
|
||||||
|
|
||||||
if returncode != 0:
|
if returncode != 0:
|
||||||
self.task_failed.emit(f"Return code: {returncode}")
|
self.task_failed.emit(f"Return code: {returncode}")
|
||||||
|
|
Loading…
Reference in a new issue