Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This could use some documentation. I'll update integration tests as several of them failed on this one...
On a second thought, is it really a good idea to exit non-zero if everything is up to date already? I realize it may be useful information for some wrapping tools, so maybe have this behavior behind some option?
BTW, this applies both to the case where update was run and there was nothing to install, and to the case where update was skipped based on some flags (like no updates-available flag, and user didn't forced an update).

return ret_code


def parse_args(args):
Expand Down