Commit Graph
21 Commits
Author SHA1 Message Date
Christian Manivong 70ad7883bc feat(time-sync): servers and zone through OpenMediaVault's own settings
driver / standard (pull_request) Successful in 17s
driver / lint (pull_request) Successful in 17s
driver / types (pull_request) Successful in 1m15s
driver / test (3.12) (pull_request) Successful in 1m11s
driver / test (3.13) (pull_request) Successful in 1m0s
driver / lowest (pull_request) Successful in 30s
driver / build (pull_request) Successful in 34s
driver / security (pull_request) Successful in 1m12s
CI / driver (pull_request) Successful in 2m58s
driver / publish (pull_request) Skipped
napalm-linux now brings napalm-device-types' PosixTimeSyncMixin (4.35.0). Its write -- a chrony drop-in with every other source commented out, timedatectl set-timezone -- is the wrong way in on OpenMediaVault: OMV generates chrony.conf and the zone from conf.system.time through Salt and would take the change back on its next deploy, the web UI would keep showing its own servers, and netOrk's automatic alignment would rewrite on every poll (NetOrk/netork#2370).

OmvTimeSyncMixin reads the servers and the zone from System.getTimeSettings (no servers while NTP is off) and keeps the host's reading for whether the clock is synchronised and by which client. Both values are written through System.setTimeSettings, NTP switched on for servers, and only the modules that change made dirty are applied, plus chrony and timezone if already dirty, as set_hostname does. A value OMV already has is not written again, so a second write changes nothing. The floor rises to napalm-device-types 4.35.0.
2026-11-11 15:18:56 +01:00
Christian Manivong 9551b7434a feat(local-accounts): a deleted key can take the password with it
driver / standard (pull_request) Successful in 17s
driver / lint (pull_request) Successful in 14s
driver / test (3.13) (pull_request) Successful in 1m12s
driver / types (pull_request) Successful in 1m20s
driver / test (3.12) (pull_request) Successful in 1m21s
driver / lowest (pull_request) Successful in 33s
driver / build (pull_request) Successful in 38s
driver / security (pull_request) Successful in 1m17s
CI / driver (pull_request) Successful in 3m5s
driver / publish (pull_request) Skipped
napalm-device-types 4.29.0 lets remove_local_account_keys clear the password and sudo too (NetOrk/netork#2033). This driver's _account_clear_password already does the work; a test pins the commands, and the floor rises to 4.29.0.
2026-11-04 15:22:51 +01:00
Christian Manivong ed083df018 feat(accounts): take replaced and deleted keys out of OMV's database
driver / standard (pull_request) Successful in 16s
driver / lint (pull_request) Successful in 14s
driver / types (pull_request) Successful in 1m40s
driver / test (3.12) (pull_request) Successful in 1m44s
driver / lowest (pull_request) Successful in 38s
driver / test (3.13) (pull_request) Successful in 1m50s
driver / build (pull_request) Successful in 35s
driver / security (pull_request) Successful in 1m15s
CI / driver (pull_request) Successful in 3m29s
driver / publish (pull_request) Skipped
napalm-device-types 4.28.0 lets add_local_account remove the old keys
(replaces) and adds remove_local_account_keys. OMV keeps a user's keys
in its own database and deploys them where the person cannot write, so
the mixin's key files alone would leave the old key deployed. The keys
go through UserMgmt.setUser, applying only what that made dirty, and
then out of ~/.ssh. Clearing the password is napalm-linux 0.17.0's.

See NetOrk/netork#2013
2026-11-04 11:48:52 +01:00
Christian Manivong 5ced67d4e4 Merge remote-tracking branch 'origin/main' into feature/scheduled-jobs
# Conflicts:
#	pyproject.toml
2026-11-03 08:35:25 +01:00
Christian Manivong a7a4e46ac2 feat(ssh): offer the SSH hardening, into the drop-in only (#20)
driver / standard (pull_request) Successful in 19s
driver / lint (pull_request) Successful in 15s
driver / test (3.12) (pull_request) Successful in 1m56s
driver / types (pull_request) Successful in 2m4s
driver / test (3.13) (pull_request) Successful in 2m7s
driver / build (pull_request) Successful in 38s
driver / lowest (pull_request) Successful in 1m51s
driver / security (pull_request) Successful in 1m52s
CI / driver (pull_request) Successful in 4m15s
driver / publish (pull_request) Skipped
OMV's generated sshd_config includes /etc/ssh/sshd_config.d, and its salt
state manages only sshd_config itself, so the drop-in napalm-linux's
hardening writes survives the next apply of the SSH settings. The opt-out
from #3 goes; SSHD_CONFIG_GENERATED (napalm-device-types 4.26.0) keeps the
hardening off sshd_config itself.
2026-11-03 07:57:08 +01:00
Christian Manivong f1524b8349 feat(scheduled-jobs): refuse every write while OMV's cron module has changes pending
driver / lint (pull_request) Successful in 18s
driver / standard (pull_request) Successful in 22s
driver / types (pull_request) Failing after 1m19s
driver / test (3.13) (pull_request) Failing after 58s
driver / test (3.12) (pull_request) Failing after 1m4s
driver / lowest (pull_request) Failing after 23s
driver / build (pull_request) Successful in 31s
driver / security (pull_request) Failing after 1m12s
CI / driver (pull_request) Failing after 2m32s
driver / publish (pull_request) Skipped
An apply of the cron module would put someone's half-finished web-UI edit
live along with ours. Decided 2026-11-03 (NetOrk/netork#1933).

Refs #18
2026-11-03 07:33:55 +01:00
Christian Manivong cc00c225a2 feat(scheduled-jobs): OMV's own jobs through Cron RPC, generated files platform (#18)
driver / standard (pull_request) Successful in 15s
driver / lint (pull_request) Successful in 14s
driver / test (3.12) (pull_request) Failing after 46s
driver / test (3.13) (pull_request) Failing after 43s
driver / types (pull_request) Failing after 1m1s
driver / lowest (pull_request) Failing after 20s
driver / build (pull_request) Successful in 27s
driver / security (pull_request) Failing after 1m4s
CI / driver (pull_request) Failing after 2m16s
driver / publish (pull_request) Skipped
OpenMediaVault writes several cron files itself, from its own database,
and writes them again on every apply: an edit napalm-linux made there
would be taken back without a word. So every file OMV generates
(/etc/cron.d/openmediavault-*, the mail-queue flush, apticron and the
recycle-bin cleanup) is platform and only runs; the inherited writers
refuse it.

The web UI's "Scheduled Jobs" and the power-management schedule live in
conf.system.cron.job. They are read through Cron.getList, disabled ones
included, instead of the lines OMV generates for them, and switched with
Cron.set, run with Cron.execute (followed through Exec.getOutput), made
with Cron.set and removed with Cron.delete. An application's job on OMV is
an OMV job, visible in its web UI, marked by its comment. Each write
applies the cron module alone, so changes pending in the web UI for other
modules stay pending. Every other job keeps napalm-linux's behaviour.

Requires napalm-device-types 4.26.0 and napalm-linux 0.16.0.

Closes #18
2026-11-03 05:46:23 +01:00
Christian Manivong deb233617c fix(disks): raise on a failed lsblk, warn on failed smartctl calls
driver / standard (pull_request) Successful in 21s
driver / lint (pull_request) Successful in 18s
driver / types (pull_request) Successful in 1m17s
driver / test (3.12) (pull_request) Successful in 1m12s
driver / test (3.13) (pull_request) Successful in 1m7s
driver / lowest (pull_request) Successful in 42s
driver / build (pull_request) Successful in 51s
driver / security (pull_request) Successful in 1m35s
CI / driver (pull_request) Successful in 3m26s
driver / publish (pull_request) Skipped
get_disks swallowed a failed or garbled lsblk and returned [], the
answer for a NAS without disks, so every disk vanished on a transient
error. It now raises CommandErrorException; a failed /proc/mdstat read
raises too instead of dropping every pool.

A smartctl call that timed out, was refused by sudo or could not open
the device was logged at debug level and read like a disk without
SMART. It is now logged as a warning with the reason (exit status bits
0 and 1; the disk-state bits 2-7 are not a failed call).

A disk whose verdict passed but that counts reallocated, pending or
offline-uncorrectable sectors (ATA), grown defects (SAS), or sets a
critical warning or counts media errors (NVMe) is reported as
"warning", as the contract allows.

get_disks shrinks below its baseline entries, which are tightened.

Closes #16
2026-11-02 08:42:48 +01:00
Christian Manivong e09af917c8 fix(disks): read a SAS disk's temperature
driver / standard (pull_request) Successful in 16s
driver / lint (pull_request) Successful in 13s
driver / types (pull_request) Successful in 1m2s
driver / test (3.12) (pull_request) Successful in 1m1s
driver / test (3.13) (pull_request) Successful in 58s
driver / lowest (pull_request) Successful in 28s
driver / build (pull_request) Successful in 27s
driver / security (pull_request) Successful in 1m5s
CI / driver (pull_request) Successful in 2m35s
driver / publish (pull_request) Skipped
A SCSI/SAS disk prints its temperature as "Current Drive Temperature:
28 C", which matched none of the ATA and NVMe patterns, so every SAS
disk read -1. Found in the smartctl output recorded from a Proxmox host.
A QEMU disk without a sensor prints 0 C there and keeps reading -1.
2026-11-01 22:15:35 +01:00
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