Commit Graph
12 Commits
Author SHA1 Message Date
Christian Manivong c8f4a0b1f7 test(disks): use recorded smartctl output
The get_disks tests ran against hand-written smartctl sections. They now
read smartctl -iHA as recorded on real hosts: an ATA SATA DOM and an
NVMe SSD (PASSED), a SAS SSD (OK) and a QEMU disk without SMART, with
serial numbers, WWNs and LU ids replaced. The failing verdicts replace
the verdict line of a recording, as no failing disk was at hand. A
recorded /proc/mdstat without arrays is added too.
2026-11-01 22:14:40 +01:00
Christian Manivong 6b9ba25773 fix(disks): read the SMART verdict and md membership correctly
driver / standard (pull_request) Successful in 14s
driver / lint (pull_request) Successful in 13s
driver / types (pull_request) Successful in 1m6s
driver / test (3.12) (pull_request) Successful in 1m2s
driver / test (3.13) (pull_request) Successful in 56s
driver / lowest (pull_request) Successful in 28s
driver / build (pull_request) Successful in 28s
driver / security (pull_request) Successful in 1m5s
CI / driver (pull_request) Successful in 2m34s
driver / publish (pull_request) Skipped
get_disks ran smartctl -iA, and neither -i nor -A prints the overall
verdict: only -H does. A disk read unknown, and an ATA disk read failed
from the WHEN_FAILED column header of its attribute table. It now asks
-iHA and reads the verdict line (ATA/NVMe) or SCSI health status only.

Array membership matched the disk name as a substring of the mdstat
line, so sda joined the array of sdaa1. A disk now owns only itself and
its partitions, and /proc/mdstat is read once per call.

Closes #4
2026-11-01 21:47:49 +01:00
Christian Manivong 61ee8c8db8 fix: no fixed uid for netOrk's own account on OMV yet (NetOrk/netork#1817)
driver / standard (pull_request) Successful in 15s
driver / lint (pull_request) Successful in 15s
driver / types (pull_request) Successful in 1m26s
driver / test (3.12) (pull_request) Successful in 1m20s
driver / test (3.13) (pull_request) Successful in 1m12s
driver / lowest (pull_request) Successful in 29s
driver / build (pull_request) Successful in 28s
driver / security (pull_request) Successful in 1m11s
CI / driver (pull_request) Successful in 3m1s
driver / publish (pull_request) Skipped
Its keys go through UserMgmt, which knows only the users it made, and whether
setUser takes a uid is untested: _account_create_with_uid raises
NotImplementedError, so the switch fails and says why.
2026-11-01 12:42:31 +01:00
Christian Manivong d477fb1a76 feat: personal accounts the way OMV's web UI makes them (NetOrk/netork#1793)
driver / standard (pull_request) Failing after 14s
driver / lint (pull_request) Successful in 14s
driver / types (pull_request) Failing after 1m13s
driver / test (3.13) (pull_request) Failing after 1m6s
driver / test (3.12) (pull_request) Failing after 1m17s
driver / lowest (pull_request) Failing after 29s
driver / build (pull_request) Successful in 28s
driver / security (pull_request) Successful in 1m5s
CI / driver (pull_request) Failing after 2m25s
driver / publish (pull_request) Skipped
napalm-linux adds and locks accounts with shadow-utils and keys in ~/.ssh.
OMV's sshd lets in only root and _ssh, and OMV keeps a user's keys in its
own database, deploying them to /var/lib/openmediavault/ssh/authorized_keys.
So a new account is made by UserMgmt.setUser in _ssh, one made outside OMV
joins _ssh when it is opened, and keys go through setUser. Each call applies
the modules it made dirty (postfix, ssh) and leaves what was pending in the
web UI pending. setUser takes a plain password, netOrk only the hash, so the
hash is set with usermod -p. The lock stays napalm-linux's expiry.

Checked on a fresh OMV 8 (Debian 13) with the real driver over SSH and
sudo -S: a new account logs in with its key and uses sudo, is refused
after locking with OMV's keys emptied, logs in again after reopening; an
account made outside OMV is let in once it joined _ssh; a module left
dirty before stays dirty.
2026-10-31 23:43:43 +01:00
Christian Manivong de8f041100 feat: set_hostname through OMV's own database
driver / standard (pull_request) Successful in 17s
driver / lint (pull_request) Successful in 15s
driver / types (pull_request) Successful in 1m7s
driver / test (3.13) (pull_request) Successful in 1m0s
driver / lowest (pull_request) Successful in 26s
driver / security (pull_request) Successful in 1m9s
driver / build (pull_request) Successful in 31s
driver / test (3.12) (pull_request) Successful in 1m9s
CI / driver (pull_request) Successful in 1m9s
driver / publish (pull_request) Skipped
napalm-linux now renames a host through hostnamectl, /etc/hostname and
/etc/hosts (NAPALM/napalm-linux#45). OMV regenerates those files from
conf.system.network.dns on its next apply, so the inherited rename would
not last.

set_hostname() goes where OMV's web UI goes: Network.setGeneralSettings
(an FQDN sets the domain too, a bare name keeps it), then
Config.applyChanges with an explicit module list -- the modules the
rename made dirty, plus the hostname modules that already were. Changes
someone left pending in the web UI stay pending. Checked against the RPC
sources of OMV 8.6 (rpc/network.inc, rpc/config.inc).
2026-10-29 23:11:04 +01:00
Christian Manivong aba36b3b11 chore: adopt the NAPALM driver standard
driver / standard (pull_request) Successful in 15s
driver / lint (pull_request) Successful in 12s
driver / types (pull_request) Successful in 55s
driver / test (3.10) (pull_request) Successful in 58s
driver / test (3.11) (pull_request) Successful in 56s
driver / lowest (pull_request) Successful in 26s
driver / test (3.12) (pull_request) Successful in 55s
driver / test (3.13) (pull_request) Successful in 48s
driver / build (pull_request) Successful in 24s
driver / security (pull_request) Successful in 58s
CI / driver (pull_request) Successful in 3m0s
driver / publish (pull_request) Skipped
- CI moves to .gitea/workflows/ci.yml and calls the shared driver workflow
  of NAPALM/driver-standard; napalm-device-types and napalm-linux come from
  git until napalm-linux 0.15.0 is on PyPI.
- requires-python >=3.10 (napalm-device-types needs it), SPDX license
  string, setuptools>=77, LICENSE file, py.typed, links to git.netork.io.
- Dependencies: napalm-device-types>=4.22.0, napalm-linux>=0.15.0,
  napalm>=4.0 (tested at 4.0.0); dev extra with pytest, pytest-cov, mypy
  and ruff.
- mypy strict for the whole package, no exempt module: _omv_read is
  annotated as returning list[dict[str, Any]] (types only).
- Coverage floor 15 % (measured 15.89 %); the four long getters and the
  complexity of get_disks are recorded in the quality baseline.
- README (what it is, how it connects, the getters, what it does not do)
  and CHANGELOG are new.
- The committed egg-info and __pycache__ files are untracked; .gitignore
  from the template keeps them, .venv and build output out.
2026-10-23 12:07:04 +02:00
Christian Manivong 6d82fad80a style: ruff format and the lint rules of the driver standard
Mechanical: ruff format, and ruff check --fix with the rule set every NAPALM
driver uses (E, F, I, UP, B at line length 100, Python 3.10). What ruff
cannot fix comes in the next commit.
2026-10-23 12:04:32 +02:00
Christian Manivong 8b41a948be 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
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).
2026-10-17 09:39:16 +02:00
Christian Manivong f68c758338 fix: opt out of the SSH hardening inherited from napalm-linux
CI / test (3.10) (pull_request) Failing after 20s
CI / test (3.11) (pull_request) Failing after 18s
CI / test (3.12) (pull_request) Failing after 19s
CI / test (3.10) (push) Successful in 28s
CI / test (3.11) (push) Successful in 27s
CI / test (3.12) (push) Successful in 29s
OpenMediaVault generates sshd_config from its own database; a drop-in
netOrk wrote would be dropped by the next apply of the SSH settings
without a word. harden_ssh_server = None makes netOrk's capability probe
answer no.

Requires napalm-linux 0.5.0; bumps to 0.1.1. NetOrk/netork#1027
2026-10-11 23:12:34 +02:00
Christian Manivong d61086ff5f feat: declare that upgrading everything must be a full upgrade on OpenMediaVault
A plain apt-get upgrade holds back OMV's own packages and the kernel;
omv-upgrade is a dist-upgrade. netOrk reads FULL_UPGRADE when it upgrades
the host (MVP 5).
2026-10-06 12:27:02 +02:00
Christian ManivongandClaude Sonnet 4.6 46c4c13f3d feat: TYPE_LABEL = "Storage" replaces storage_device = True flag
The TYPE_LABEL attribute on the base class hierarchy is now the
canonical way for drivers to declare their device category. The
storage_device sentinel flag is removed — classification is determined
by reading TYPE_LABEL via getattr() in the backend.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-24 11:38:36 +02:00
Christian Manivong 302c5b95cd init 2026-06-13 03:18:28 +02:00