Commit Graph
2 Commits
Author SHA1 Message Date
Christian Manivong 4268edc7a7 feat(services-restart): which services still run replaced code, as root (NetOrk/netork#2700)
LinuxProcessReadingsMixin carries napalm-device-types' ServicesRestartMixin:
its command goes through the driver's sudo like the listening sockets, and
there is no unprivileged retry, since a reading of the login user's own
processes would read as clean.
2026-11-26 17:40:04 +01:00
Christian Manivong d3134c83b8 fix(sudo): run the whole command as root without a sudo password
Without a root login and without a sudo password, _run_privileged typed
"sudo -n <command>" into the interactive shell. sudo covered only the
first simple command of the line, and dnf's and yum's advisory query,
which starts with a brace group, did not parse at all: no status marker
ever arrived, so netmiko waited out the 120 s read timeout and
get_available_updates() failed. This is the default path for netOrk's
own NOPASSWD account.

The command now goes to "sudo -n sh -c" as one argument, as _as_root
already does with a password. A status echo at its end stays outside
sh -c: it reports sh's status, which is the command's, and still
arrives when sudo refuses.

Closes #56
2026-11-02 08:39:50 +01:00