Skip to content

Commit ef83842

Browse files
committed
Fix repo setting logic in global config
fixes QubesOS/qubes-issues#9366 fixes QubesOS/qubes-issues#9868 fixes QubesOS/qubes-issues#8802
1 parent 7ab4e2e commit ef83842

1 file changed

Lines changed: 13 additions & 6 deletions

File tree

qubes_config/global_config/updates_handler.py

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -200,14 +200,21 @@ def save(self):
200200
if not self.repos:
201201
return
202202
for repo_dict in self.repo_to_widget_mapping:
203-
found = False
203+
# the logic here goes: we have two kinds of widgets,
204+
# radio buttons for dom0 update (where we want to enable everything up to
205+
# the selected option)
206+
# checkbuttons for everything else (where we just want to enable/disable
207+
# based on state)
208+
dom0_found = False
204209
for repo, widget in repo_dict.items():
205-
try:
206-
if widget.get_active():
207-
found = True
208-
self._set_repository(repo, True)
210+
state = widget.get_active()
211+
if "dom0" in repo:
212+
if state:
213+
dom0_found = True
209214
else:
210-
self._set_repository(repo, not found)
215+
state = not dom0_found
216+
try:
217+
self._set_repository(repo, state)
211218
except RuntimeError as ex:
212219
raise qubesadmin.exc.QubesException(
213220
"Failed to set repository data: " f"{escape(str(ex))}"

0 commit comments

Comments
 (0)