Flag hosts without room on disk for their pending upgrades
CI / tests (Python 3.10) (pull_request) Successful in 43s
CI / tests (Python 3.11) (pull_request) Successful in 44s
CI / tests (Python 3.12) (pull_request) Successful in 43s
CI / tests (Python 3.13) (pull_request) Successful in 42s
CI / lint (pull_request) Successful in 3s
CI / tests (Python 3.10) (pull_request) Successful in 43s
CI / tests (Python 3.11) (pull_request) Successful in 44s
CI / tests (Python 3.12) (pull_request) Successful in 43s
CI / tests (Python 3.13) (pull_request) Successful in 42s
CI / lint (pull_request) Successful in 3s
A filesystem that fills up while apt downloads or dpkg unpacks leaves the upgrade half-done and apt broken, the same failure as a full /boot but on / or /var. Nothing caught it until the host's updates stopped. The agent (0.11.0) now works out what the pending upgrades need. A simulation doesn't print apt's "Need to get" or "additional disk space" lines, so it sums the package records from apt-cache show for each version the simulation would install: Size for each .deb not already in /var/cache/apt/archives, and the growth in Installed-Size over the installed versions (from dpkg-query). Removals aren't subtracted, so it errs high. It also reports free space and the mount point of the filesystems holding /var/cache/apt/archives and /usr. The server puts a host in update when the upgrades would leave less than upgrade_min_free_mb (default 100, 0 disables) on either filesystem. The download and the install both count when they're on the same one. With nothing pending there is nothing to check, so this doesn't turn into general disk monitoring. The host page gets a "Pending upgrades size" row. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
b5be19f85d
commit
15b1f5be4f
13 files changed
+363
-7
No files matched your search
@@ -33,6 +33,10 @@ class Config:
|
||||
# Less free space than this on /boot's filesystem puts a host in update: the next
|
||||
# kernel (image plus initramfs, often over 100 MB) may not fit. 0 disables.
|
||||
boot_min_free_mb: int = 200
|
||||
# Pending upgrades that would leave less free space than this on the filesystem
|
||||
# apt downloads to, or the one /usr is on, put a host in update: dpkg would run
|
||||
# out of room part-way. 0 disables.
|
||||
upgrade_min_free_mb: int = 100
|
||||
# Note a host this many days before its OS release stops getting security updates
|
||||
# (or Ubuntu standard support ends without ESM). 0 disables the warning; a host
|
||||
# past the date is in update either way.
|
||||
@@ -116,6 +120,8 @@ def load(path: str | None = None) -> Config:
|
||||
raise SystemExit(f"{path}: os_eol_warn_days must be zero or positive")
|
||||
if cfg.boot_min_free_mb < 0:
|
||||
raise SystemExit(f"{path}: boot_min_free_mb must be zero or positive")
|
||||
if cfg.upgrade_min_free_mb < 0:
|
||||
raise SystemExit(f"{path}: upgrade_min_free_mb must be zero or positive")
|
||||
if cfg.backup_keep_days < 0:
|
||||
raise SystemExit(f"{path}: backup_keep_days must be zero or positive")
|
||||
if not cfg.backup_dir.startswith("/") or any(ord(c) < 32 or ord(c) == 127 for c in cfg.backup_dir):
|
||||
|
||||
Reference in new issue
Block a user