netOrk asks a driver for reboot_host (napalm-device-types' HostRebootMixin) before it offers a restart. The Linux driver had none, so netOrk could not restart a Linux host at all (netOrk #637). The same goes for OpenMediaVault and QTS, which inherit this driver.
Change
reboot_host runs /sbin/reboot through _run_privileged, detached and two seconds late:
the launcher's exit status comes back before the host goes down;
closing the session cannot take the restart with it.
A refusal, such as sudo without a password, raises RuntimeError with what the host said and the sudo-password hint.
Verification
pytest tests/: 122 tests pass, including TestRebootHost:
the method exists on the class;
the command is detached and privileged, with the exit marker;
a refusal raises;
output with no exit status is not a success.
ruff: 0 findings before and after. mypy: the same 47 pre-existing errors before and after.
Gate test on searxng-01 (netOrk api container, this module injected, /sbin/reboot replaced by touch /tmp/netork-reboot-gate):
netOrk's can_reboot says True for the new class;
reboot_host returned;
the file appeared, owned by root, after 2 s;
it was removed afterwards.
netOrk asks a driver for `reboot_host` (napalm-device-types' `HostRebootMixin`) before it offers a restart. The Linux driver had none, so netOrk could not restart a Linux host at all (netOrk #637). The same goes for OpenMediaVault and QTS, which inherit this driver.
## Change
`reboot_host` runs `/sbin/reboot` through `_run_privileged`, detached and two seconds late:
- the launcher's exit status comes back before the host goes down;
- closing the session cannot take the restart with it.
A refusal, such as sudo without a password, raises `RuntimeError` with what the host said and the sudo-password hint.
## Verification
- `pytest tests/`: 122 tests pass, including `TestRebootHost`:
- the method exists on the class;
- the command is detached and privileged, with the exit marker;
- a refusal raises;
- output with no exit status is not a success.
- ruff: 0 findings before and after. mypy: the same 47 pre-existing errors before and after.
- **Gate test on searxng-01** (netOrk api container, this module injected, `/sbin/reboot` replaced by `touch /tmp/netork-reboot-gate`):
- netOrk's `can_reboot` says True for the new class;
- `reboot_host` returned;
- the file appeared, owned by root, after 2 s;
- it was removed afterwards.
netOrk asks a driver for reboot_host before it offers a restart, and the
Linux driver had none, so a Linux host -- and OpenMediaVault and QTS, which
inherit this driver -- could not be restarted from netOrk at all (netOrk
#637). reboot_host runs /sbin/reboot detached and two seconds late through
_run_privileged: the launcher's exit status comes back before the host goes
down, and closing the session cannot take the restart with it. A refusal
(sudo without a password) raises with what the host said.
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
netOrk asks a driver for
reboot_host(napalm-device-types'HostRebootMixin) before it offers a restart. The Linux driver had none, so netOrk could not restart a Linux host at all (netOrk #637). The same goes for OpenMediaVault and QTS, which inherit this driver.Change
reboot_hostruns/sbin/rebootthrough_run_privileged, detached and two seconds late:A refusal, such as sudo without a password, raises
RuntimeErrorwith what the host said and the sudo-password hint.Verification
pytest tests/: 122 tests pass, includingTestRebootHost:/sbin/rebootreplaced bytouch /tmp/netork-reboot-gate):can_rebootsays True for the new class;reboot_hostreturned;