Repository navigation
Report failed upgrades with a non-zero exit status - #1115
Open
Amadeus-22 wants to merge 1 commit into
Open
Amadeus-22 wants to merge 1 commit into
Amadeus-22 wants to merge 1 commit into
Conversation
mint-refresh-cache, mintupdate-cli and system_automatic_upgrades.py all exited with 0 when the cache refresh or apt-get failed, and the log always ended with "-- Automatic Upgrade completed", so a failed automatic upgrade looked like a successful one to systemd and to any script (linuxmint#1107). - mint-refresh-cache: Exit with 1 when the update fails or when it is run without admin privileges. - mintupdate-cli.py: Exit with apt-get's status. When the refresh failed the upgrade still runs on the current cache as before, but the exit status is 1 if apt-get itself succeeded. - system_automatic_upgrades.py: Log "-- Automatic Upgrade failed (exit N)" and exit with that status, so mintupdate-automation-upgrade.service is marked failed. Successful runs are unchanged. Add tests/test_exit_status.py. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #1107
Problem
A failed cache refresh or a failed apt-get still ends with exit status 0 everywhere:
mint-refresh-cacheprints an error and exits 0,mintupdate-cliignores the status of both the refresh and apt-get, andsystem_automatic_upgrades.pyignores the result and always logs-- Automatic Upgrade completed.mintupdate-automation-upgrade.serviceis never marked failed, so runs like the ones in #1109 only show up in/var/log/mintupdate.log.Fix
mint-refresh-cache:sys.exit(1)when the update fails or when run without admin privileges.mintupdate-cli.py: exit with apt-get's status. If the refresh failed, the upgrade still runs on the current cache as before (one unreachable repository shouldn't block every update), but the exit status is 1 when apt-get succeeded.system_automatic_upgrades.py: log-- Automatic Upgrade failed (exit N)and exit with that status. A run skipped on battery still exits 0.Successful runs are unchanged.
How tested
tests/test_exit_status.py(cli exit status for each refresh/apt-get combination,mint-refresh-cachewithout root);/usr/bin/python3 -m unittest discover -s tests, 17 tests OK.apt-getonPATHthat exits 100,mintupdate-cli upgrade --dry-runexits 100 (0 on master). A real--dry-runstill exits 0.system_automatic_upgrades.pywith its paths pointed at a temporary directory and a fakesystemd-inhibit: exit 0 logs-- Automatic Upgrade completedand exits 0; exit 100 logs-- Automatic Upgrade failed (exit 100)and exits 100.🤖 Generated with Claude Code