fix: read every share from OMV's own database, with its service, 0.4.0 (NetOrk/netork#3104) #25

Merged
christianmanivong merged 2 commits from feature/share-endpoints into main 2026-12-03 17:59:54 +00:00
Owner

Fixes the share reading of NetOrk/netork#3104, on napalm-device-types 4.58.0 and napalm-linux 0.27.0.

What was broken: get_shares() found no share at all on a real OMV 8.8 host. It asked for data models OMV does not have (conf.service.nfs.shares; the models are conf.service.*.share), without root although config.xml is 0660 root:openmediavault-config, without the full path although /usr/sbin is not on a login user's PATH, and stored every failure as a NAS without shares. It would also have dropped every Samba share (no name field; the share is its shared folder's name) and let several NFS clients of one folder overwrite each other.

Now (_shares.OmvSharesMixin):

  • every model in one sudo round trip; a plugin that is not installed has no model and no shares; a model that fails, a report cut short or sudo refusing raises;
  • Samba, NFS (one share per folder, one access rule per client with options and comment), FTP, rsync modules, the TFTP plugin's root and Samba's homes;
  • each share names its service (smbd, nfs-server, proftpd, rsync, tftpd-hpa) and its export (/export/<folder> over NFS); enabled only while OMV has the service on; volume is the file system.

Checked against the real host: 11 Samba, 3 NFS, 1 FTP and 1 TFTP share. Version 0.4.0; tag v0.4.0 after the merge.

Fixes the share reading of NetOrk/netork#3104, on napalm-device-types 4.58.0 and napalm-linux 0.27.0. **What was broken:** `get_shares()` found no share at all on a real OMV 8.8 host. It asked for data models OMV does not have (`conf.service.nfs.shares`; the models are `conf.service.*.share`), without root although `config.xml` is `0660 root:openmediavault-config`, without the full path although `/usr/sbin` is not on a login user's `PATH`, and stored every failure as a NAS without shares. It would also have dropped every Samba share (no name field; the share is its shared folder's name) and let several NFS clients of one folder overwrite each other. **Now** (`_shares.OmvSharesMixin`): - every model in one sudo round trip; a plugin that is not installed has no model and no shares; a model that fails, a report cut short or sudo refusing raises; - Samba, NFS (one share per folder, one access rule per client with options and comment), FTP, rsync modules, the TFTP plugin's root and Samba's `homes`; - each share names its service (`smbd`, `nfs-server`, `proftpd`, `rsync`, `tftpd-hpa`) and its `export` (`/export/<folder>` over NFS); enabled only while OMV has the service on; `volume` is the file system. Checked against the real host: 11 Samba, 3 NFS, 1 FTP and 1 TFTP share. Version 0.4.0; tag `v0.4.0` after the merge.
christianmanivong added 2 commits 2026-12-03 17:57:43 +00:00
get_shares() found no share at all: it asked for data models OMV does not have
(conf.service.nfs.shares and its siblings), without root although config.xml is
root's, without the full path although /usr/sbin is not on a login user's PATH,
and stored every failure as a NAS without shares. Samba shares were dropped for
want of a name of their own, and several NFS clients of one folder overwrote
each other.

Now every model is read through sudo in one round trip; a share takes its shared
folder's name; NFS is one share per folder with one access rule per client; each
share names its service (smbd, nfs-server, proftpd, rsync, tftpd-hpa) and what a
client names (/export/<folder> over NFS); rsync modules, the TFTP root and Samba's
homes are shares too; a read that fails raises.
refactor: OMV's report and its NFS shares read in smaller parts (NetOrk/netork#3104)
driver / lint (pull_request) Successful in 12s
driver / standard (pull_request) Successful in 15s
driver / lowest (pull_request) Successful in 26s
driver / types (pull_request) Successful in 1m2s
driver / test (3.12) (pull_request) Successful in 1m2s
driver / test (3.13) (pull_request) Successful in 52s
driver / build (pull_request) Successful in 24s
driver / security (pull_request) Successful in 1m0s
CI / driver (pull_request) Successful in 1m41s
driver / publish (pull_request) Skipped
6e94ce8ffd
The standard's ratchet: a new function stays within complexity 10.
christianmanivong merged commit c56a5506e6 into main 2026-12-03 17:59:54 +00:00
christianmanivong deleted branch feature/share-endpoints 2026-12-03 17:59:54 +00:00
Sign in to join this conversation.