fix: adapt to napalm-device-types 4.7
CI / test (3.10) (push) Successful in 38s
CI / test (3.11) (push) Successful in 37s
CI / test (3.12) (push) Successful in 39s

napalm-device-types 4.7 changed three things this driver depends on:

- parse_dnf_security needs the "__DNF_RC=<status>" line that
  DNF_SECURITY_COMMAND prints and raises ValueError without it or when dnf
  failed. The yum security query had no such line, so listing updates on
  any yum host raised. _YUM_SECURITY_COMMAND now prints the marker the same
  way ("{ ...; echo __DNF_RC=$?; } | cat"). _rpm_security_names checks
  __DNF_RC itself and turns a failed query, or output cut short before the
  marker, into None (security unknown) rather than "no advisories" or an
  exception.
- OSDriver.get_users was renamed to get_os_users, since NAPALM's own
  get_users has another shape. LinuxDriver.get_users is now get_os_users
  with the same return value.
- run_on_transport reads an exec channel to EOF after its exit status
  arrives; the tests' fake channels gain recv/recv_stderr for that.

Require napalm-device-types>=4.7.1 and bump the version to 0.6.0.
This commit is contained in:
christianmanivong committed 2026-10-13 06:25:17 +00:00
1 parent 81b2df9d71
commit 350e3a6d6e
8 files changed
+141 -15

No files matched your search

+18
View File
@@ -7,6 +7,24 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [Unreleased]
### Changed
- Requires napalm-device-types 4.7.1 or later; version 0.6.0.
- **Breaking:** `get_users()` is now `get_os_users()`, following napalm-device-types
4.7, which renamed `OSDriver.get_users` because NAPALM's own `get_users` has
another shape. The return value is unchanged (a list of `UserDict`).
`get_users()` is NAPALM's again and raises `NotImplementedError`.
### Fixed
- Listing updates on yum hosts (RHEL 7, CentOS 7) no longer fails with
napalm-device-types 4.7: its `parse_dnf_security` needs the `__DNF_RC=<status>`
line `DNF_SECURITY_COMMAND` prints, and the yum security query had none, so it
raised `ValueError`. The yum query now prints that marker the same way
(`{ ...; echo __DNF_RC=$?; } | cat`). A yum or dnf security query that failed,
or whose output was cut short before the marker, still leaves `security` unknown
(`None`) instead of reporting no advisories.
### Security
- `run_command(privileged=True, stdin=...)` raises `ValueError` while a sudo