feat: drop the get_device_warnings override; the pending updates are the fact (0.2.0)
CI / test (3.10) (push) Successful in 28s
CI / test (3.11) (push) Successful in 26s
CI / test (3.12) (push) Successful in 28s
CI / test (3.10) (pull_request) Successful in 26s
CI / test (3.11) (pull_request) Successful in 26s
CI / test (3.12) (pull_request) Successful in 27s
CI / test (3.10) (push) Successful in 28s
CI / test (3.11) (push) Successful in 26s
CI / test (3.12) (push) Successful in 28s
CI / test (3.10) (pull_request) Successful in 26s
CI / test (3.11) (pull_request) Successful in 26s
CI / test (3.12) (pull_request) Successful in 27s
The override counted "N upgraded" in an apt simulation run without a fixed locale -- nothing matched on a German host -- and hid held-back packages, which FULL_UPGRADE installs. netOrk names updates_available from get_available_updates (netOrk #1111).
This commit is contained in:
1 parent
508f3dcb37
commit
8b41a948be
3 files changed
+13
-39
No files matched your search
@@ -85,44 +85,6 @@ class OpenMediaVaultDriver(StorageDriver, LinuxDriver):
|
||||
pass
|
||||
return facts
|
||||
|
||||
# ── Warnings ──────────────────────────────────────────────────────────────
|
||||
|
||||
def get_device_warnings(self) -> list[dict[str, Any]]:
|
||||
"""Return warnings, ignoring packages held back by apt-get upgrade.
|
||||
|
||||
On OMV, kernel and OMV-specific packages are routinely held back
|
||||
(they require dist-upgrade or omv-upgrade). Reporting them as
|
||||
"updates available" after a successful apt-get upgrade is misleading.
|
||||
We simulate the upgrade first and only warn if there are packages
|
||||
that a standard apt-get upgrade would actually install.
|
||||
"""
|
||||
warnings: list[dict[str, Any]] = []
|
||||
try:
|
||||
sim = self._sudo(
|
||||
"DEBIAN_FRONTEND=noninteractive apt-get upgrade --simulate 2>&1",
|
||||
read_timeout=60,
|
||||
)
|
||||
m = re.search(r'(\d+) upgraded', sim)
|
||||
upgradable_count = int(m.group(1)) if m else 0
|
||||
except Exception:
|
||||
upgradable_count = -1 # unknown — fall back to parent behaviour
|
||||
|
||||
if upgradable_count == 0:
|
||||
return [] # nothing to do with apt-get upgrade; held-back only
|
||||
if upgradable_count < 0:
|
||||
return super().get_device_warnings()
|
||||
|
||||
updates = self.get_available_updates()
|
||||
if updates:
|
||||
warnings.append({
|
||||
"code": "updates_available",
|
||||
"meta": {
|
||||
"count": upgradable_count,
|
||||
"packages": [u.get("name", "") for u in updates[:10]],
|
||||
},
|
||||
})
|
||||
return warnings
|
||||
|
||||
# ── Physical disks ─────────────────────────────────────────────────────────
|
||||
|
||||
def get_disks(self) -> list[PhysicalDiskDict]:
|
||||
|
||||
Reference in new issue
Block a user