get_host_status() now tells an interrupted package manager on hosts without dpkg too, and names the one it read in the new package_manager field (dpkg, dnf, yum, apk, opkg, or None). The reading lives in a new module, napalm_device_types/package_managers.py, whose command part is appended to HOST_STATUS_COMMAND; host_status.py picks the reading that says most (interrupted, then clean, then busy).
dnf / yum (rpm): a package installed in two versions (rpm -qa --qf '%{NAME} %{ARCH}', duplicates), leaving out dnf's default installonlypkgs plus any the host adds in dnf.conf (asked of rpm by what they provide) and gpg-pubkey: state duplicate. A transaction that never ended: dnf 4's newest row in the libdnf trans table still at state 0 (UNKNOWN; finish() writes 1 DONE or 2 ERROR), read read-only through Python's sqlite3, or yum's transaction-all.* journal in /var/lib/yum (one renamed .disabled is ignored, as yum-complete-transaction does). dnf 5's history is not read, only its duplicates.
apk: a package whose f: line in /lib/apk/db/installed carries f (broken files) or s (broken script): broken-files, broken-script. These are the packages apk fix with no arguments picks. x and S are not faults.
opkg: a package in /usr/lib/opkg/status whose Status: is unpacked, half-configured or half-installed, or that has the reinstreq flag (reinstall-required).
Busy: while rpm, dnf, dnf5, yum, dnf-automatic, packagekitd, apk or opkg runs (from /proc/<pid>/comm, which BusyBox hosts have too), that manager's answer is None.
Everything is read without root and changes nothing. MINOR: a new field.
Why
NetOrk/netork#851, a follow-up to #738, which covered dpkg only. netOrk decides what to do with it: it repairs opkg (opkg configure) and only warns for dnf, yum and apk.
Sources for the formats
libdnf transaction/Types.hpp (TransactionState), transaction/sql/create_tables.sql (trans), transaction/private/Transaction.cpp (begin/finish); dnf cli/output.py and db/history.py (how history shows an unfinished transaction).
yum-utils yum-complete-transaction (the transaction-all* journal in /var/lib/yum).
apk-tools src/database.c (the f: field and its flags), src/app_fix.c (what apk fix picks with no arguments), src/commit.c.
opkg-lede libopkg/pkg.c (state words, the Status: line), libopkg/opkg_cmd.c (opkg configure configures every SS_UNPACKED package).
Tests
Fixtures only. The outputs are shaped after the formats above. They have not been recorded on a host yet and should be checked against an Oracle Linux 9 host (dnf) and an OpenWrt 25.12 router (apk). Per manager: clean means not interrupted, interrupted means it is reported with its packages, and busy means unknown. The command part also runs on a real sh and on busybox sh, with stand-in rpm, dnf, apk and opkg, a stand-in sqlite history and status files. The whole command runs under busybox sh. The full suite passes (1463 passed, 2 skipped; coverage 97 %). ruff and mypy --strict are clean.
## What
`get_host_status()` now tells an interrupted package manager on hosts without dpkg too, and names the one it read in the new `package_manager` field (`dpkg`, `dnf`, `yum`, `apk`, `opkg`, or None). The reading lives in a new module, `napalm_device_types/package_managers.py`, whose command part is appended to `HOST_STATUS_COMMAND`; `host_status.py` picks the reading that says most (interrupted, then clean, then busy).
- **dnf / yum (rpm):** a package installed in two versions (`rpm -qa --qf '%{NAME} %{ARCH}'`, duplicates), leaving out dnf's default `installonlypkgs` plus any the host adds in `dnf.conf` (asked of rpm by what they provide) and `gpg-pubkey`: state `duplicate`. A transaction that never ended: dnf 4's newest row in the libdnf `trans` table still at `state` 0 (UNKNOWN; `finish()` writes 1 DONE or 2 ERROR), read read-only through Python's `sqlite3`, or yum's `transaction-all.*` journal in `/var/lib/yum` (one renamed `.disabled` is ignored, as `yum-complete-transaction` does). dnf 5's history is not read, only its duplicates.
- **apk:** a package whose `f:` line in `/lib/apk/db/installed` carries `f` (broken files) or `s` (broken script): `broken-files`, `broken-script`. These are the packages `apk fix` with no arguments picks. `x` and `S` are not faults.
- **opkg:** a package in `/usr/lib/opkg/status` whose `Status:` is `unpacked`, `half-configured` or `half-installed`, or that has the `reinstreq` flag (`reinstall-required`).
- **Busy:** while `rpm`, `dnf`, `dnf5`, `yum`, `dnf-automatic`, `packagekitd`, `apk` or `opkg` runs (from `/proc/<pid>/comm`, which BusyBox hosts have too), that manager's answer is None.
Everything is read without root and changes nothing. MINOR: a new field.
## Why
NetOrk/netork#851, a follow-up to #738, which covered dpkg only. netOrk decides what to do with it: it repairs opkg (`opkg configure`) and only warns for dnf, yum and apk.
## Sources for the formats
- libdnf `transaction/Types.hpp` (`TransactionState`), `transaction/sql/create_tables.sql` (`trans`), `transaction/private/Transaction.cpp` (`begin`/`finish`); dnf `cli/output.py` and `db/history.py` (how history shows an unfinished transaction).
- yum-utils `yum-complete-transaction` (the `transaction-all*` journal in `/var/lib/yum`).
- apk-tools `src/database.c` (the `f:` field and its flags), `src/app_fix.c` (what `apk fix` picks with no arguments), `src/commit.c`.
- opkg-lede `libopkg/pkg.c` (state words, the `Status:` line), `libopkg/opkg_cmd.c` (`opkg configure` configures every `SS_UNPACKED` package).
## Tests
Fixtures only. The outputs are shaped after the formats above. They have not been recorded on a host yet and should be checked against an Oracle Linux 9 host (dnf) and an OpenWrt 25.12 router (apk). Per manager: clean means not interrupted, interrupted means it is reported with its packages, and busy means unknown. The command part also runs on a real `sh` and on `busybox sh`, with stand-in `rpm`, `dnf`, `apk` and `opkg`, a stand-in sqlite history and status files. The whole command runs under `busybox sh`. The full suite passes (1463 passed, 2 skipped; coverage 97 %). ruff and mypy --strict are clean.
Refs NetOrk/netork#851
get_host_status() read only dpkg's state. It now also reads the rpm
database and dnf's history (or yum's journal), apk's installed database
and opkg's status file, without root, and names the manager it read in
the new package_manager field. While one of them runs, the answer is
unknown, as for dpkg.
Refs NetOrk/netork#851
The quality ratchet records models.py at 1454 lines and the new comments
had made it 1460. bandit read the dnf history query, built with an
f-string for its path, as SQL put together from strings (B608); it is a
fixed query, now one literal with the path spelt out, and a test holds
it to DNF_HISTORY.
Refs NetOrk/netork#851
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
What
get_host_status()now tells an interrupted package manager on hosts without dpkg too, and names the one it read in the newpackage_managerfield (dpkg,dnf,yum,apk,opkg, or None). The reading lives in a new module,napalm_device_types/package_managers.py, whose command part is appended toHOST_STATUS_COMMAND;host_status.pypicks the reading that says most (interrupted, then clean, then busy).rpm -qa --qf '%{NAME} %{ARCH}', duplicates), leaving out dnf's defaultinstallonlypkgsplus any the host adds indnf.conf(asked of rpm by what they provide) andgpg-pubkey: stateduplicate. A transaction that never ended: dnf 4's newest row in the libdnftranstable still atstate0 (UNKNOWN;finish()writes 1 DONE or 2 ERROR), read read-only through Python'ssqlite3, or yum'stransaction-all.*journal in/var/lib/yum(one renamed.disabledis ignored, asyum-complete-transactiondoes). dnf 5's history is not read, only its duplicates.f:line in/lib/apk/db/installedcarriesf(broken files) ors(broken script):broken-files,broken-script. These are the packagesapk fixwith no arguments picks.xandSare not faults./usr/lib/opkg/statuswhoseStatus:isunpacked,half-configuredorhalf-installed, or that has thereinstreqflag (reinstall-required).rpm,dnf,dnf5,yum,dnf-automatic,packagekitd,apkoropkgruns (from/proc/<pid>/comm, which BusyBox hosts have too), that manager's answer is None.Everything is read without root and changes nothing. MINOR: a new field.
Why
NetOrk/netork#851, a follow-up to #738, which covered dpkg only. netOrk decides what to do with it: it repairs opkg (
opkg configure) and only warns for dnf, yum and apk.Sources for the formats
transaction/Types.hpp(TransactionState),transaction/sql/create_tables.sql(trans),transaction/private/Transaction.cpp(begin/finish); dnfcli/output.pyanddb/history.py(how history shows an unfinished transaction).yum-complete-transaction(thetransaction-all*journal in/var/lib/yum).src/database.c(thef:field and its flags),src/app_fix.c(whatapk fixpicks with no arguments),src/commit.c.libopkg/pkg.c(state words, theStatus:line),libopkg/opkg_cmd.c(opkg configureconfigures everySS_UNPACKEDpackage).Tests
Fixtures only. The outputs are shaped after the formats above. They have not been recorded on a host yet and should be checked against an Oracle Linux 9 host (dnf) and an OpenWrt 25.12 router (apk). Per manager: clean means not interrupted, interrupted means it is reported with its packages, and busy means unknown. The command part also runs on a real
shand onbusybox sh, with stand-inrpm,dnf,apkandopkg, a stand-in sqlite history and status files. The whole command runs underbusybox sh. The full suite passes (1463 passed, 2 skipped; coverage 97 %). ruff and mypy --strict are clean.Refs NetOrk/netork#851