Skip to content

Commit

Permalink
updater: return 100 if no vm was updated
Browse files Browse the repository at this point in the history
  • Loading branch information
piotrbartman committed May 27, 2024
1 parent 21e7e22 commit b643024
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
2 changes: 2 additions & 0 deletions vmupdate/update_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,8 @@ def run(self, agent_args):
self.log.info("Update Manager: Finished, collecting success info")

stats = list(progress_bar.statuses.values())
if FinalStatus.CANCELLED in stats:
self.ret_code = max(self.ret_code, 130)
if FinalStatus.ERROR in stats:
self.ret_code = max(self.ret_code, 5)
if FinalStatus.UNKNOWN in stats:
Expand Down
10 changes: 8 additions & 2 deletions vmupdate/vmupdate.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,12 +66,18 @@ def main(args=None, app=qubesadmin.Qubes()):
# independent qubes first (TemplateVMs, StandaloneVMs)
ret_code_independent, templ_statuses = run_update(
independent, args, "templates and stanalones")
no_updates = all(stat == FinalStatus.NO_UPDATES for stat in templ_statuses)
# then derived qubes (AppVMs...)
ret_code_appvm, _ = run_update(derived, args)
ret_code_appvm, app_statuses = run_update(derived, args)
no_updates = all(stat == FinalStatus.NO_UPDATES for stat in app_statuses
) and no_updates

ret_code_restart = apply_updates_to_appvm(args, independent, templ_statuses)

return max(ret_code_independent, ret_code_appvm, ret_code_restart)
ret_code = max(ret_code_independent, ret_code_appvm, ret_code_restart)
if ret_code == 0 and no_updates:
return 100
return ret_code


def parse_args(args):
Expand Down

0 comments on commit b643024

Please sign in to comment.