Skip to content

Commit 91a2ab4

Browse files
committed
Fix interrupting update
When SIGINT is sent during last qube in a given group (admin, template/standalone, derived), given group isn't really interrupted, so none of the returned update status is FinalStatus.CANCELLED. This meant that update cancel request was canceled in practice and the update proceeded to the next group uninterrupted. And also that overall exit code didn't inform about the cancellation request. Fix this by returning EXIT.SIGINT if SIGINT was received, instead of checking if any update was actually cancelled. And then check for the EXIT.SIGINT status between update groups. Fixes QubesOS/qubes-issues#10900
1 parent 32a14bb commit 91a2ab4

2 files changed

Lines changed: 10 additions & 2 deletions

File tree

vmupdate/update_manager.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -112,9 +112,11 @@ def run(self, agent_args):
112112
progress_bar.close()
113113
self.log.info("Update Manager: Finished, collecting success info")
114114

115+
# inform caller about requested cancel, even if all requested targets were updated
116+
if progress_bar.termination.value:
117+
self.ret_code = EXIT.SIGINT
118+
115119
stats = list(progress_bar.statuses.values())
116-
if FinalStatus.CANCELLED in stats:
117-
self.ret_code = max(self.ret_code, EXIT.SIGINT)
118120
if FinalStatus.ERROR in stats:
119121
self.ret_code = max(self.ret_code, EXIT.ERR)
120122
if FinalStatus.UNKNOWN in stats:

vmupdate/vmupdate.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,8 @@ def main(args=None, app=qubesadmin.Qubes()):
9393
no_updates = all(
9494
stat == FinalStatus.NO_UPDATES for stat in admin_status.values()
9595
)
96+
if ret_code_admin == EXIT.SIGINT:
97+
return EXIT.SIGINT
9698

9799
# independent qubes first (TemplateVMs, StandaloneVMs)
98100
ret_code_independent, templ_statuses = run_update(
@@ -102,12 +104,16 @@ def main(args=None, app=qubesadmin.Qubes()):
102104
all(stat == FinalStatus.NO_UPDATES for stat in templ_statuses.values())
103105
and no_updates
104106
)
107+
if ret_code_independent == EXIT.SIGINT:
108+
return EXIT.SIGINT
105109
# then derived qubes (AppVMs...)
106110
ret_code_appvm, app_statuses = run_update(derived, args, log)
107111
no_updates = (
108112
all(stat == FinalStatus.NO_UPDATES for stat in app_statuses.values())
109113
and no_updates
110114
)
115+
if ret_code_appvm == EXIT.SIGINT:
116+
return EXIT.SIGINT
111117

112118
ret_code_restart = apply_updates_to_appvm(
113119
args, independent, templ_statuses, app_statuses, log

0 commit comments

Comments
 (0)