feat(host-repairs): a host's checks and repairs as a fixed catalog of runs (NetOrk/netork#2899)
HostRepairMixin declares one method per run -- verify_system_files, repair_system_files, check_component_store, repair_component_store, update_antimalware_signatures and scan_antimalware -- so the method list is the guard, and a repair is never offered with its check. Each streams the tool's lines to log and returns a HostRepairResultDict; tool_outcome builds it from the lines and the exit code, failing a non-zero code with the tool's last lines. offered_host_repairs lists the runs a driver defines.
This commit is contained in:
1 parent
2df46741f2
commit
54bda2cb79
5 files changed
+349
No files matched your search
@@ -137,6 +137,17 @@ on its own CPU; on Debian with its archive's firmware component added first;
|
||||
change in one call overrides the template method. A driver mixes in the fixes its device
|
||||
can take; none is on a role base. They replace `run_device_action`, which is deprecated.
|
||||
|
||||
**Repair runs are a fixed catalog** (`napalm_device_types.host_repairs`). A host's own
|
||||
checks and repairs of its system are one method per run, so the method list is the guard:
|
||||
`HostRepairMixin.verify_system_files()`, `repair_system_files()`,
|
||||
`check_component_store()`, `repair_component_store()`, `update_antimalware_signatures()`
|
||||
and `scan_antimalware(quick)`. Each takes `log` for every line of the tool's output as the
|
||||
host prints it, is bounded in time by the driver and returns a `HostRepairResultDict`
|
||||
(`success`, `output`, `exit_code`, `error`); `tool_outcome(lines, exit_code, tool=...)`
|
||||
builds it, so every driver fails a run the same way (a non-zero exit code, with the tool's
|
||||
last lines). A repair is a method of its own beside its check, and a driver defines only
|
||||
the runs it can do: `offered_host_repairs(driver_cls)` lists them. None restarts the host.
|
||||
|
||||
**SNMP is the application's** (`docs/STRUCTURE.md`). `HealthMetricsMixin` is deprecated
|
||||
since 4.12 and goes in 5.0. A driver does not collect over SNMP; a driver whose device
|
||||
publishes its health values under OIDs of its own declares them as data:
|
||||
|
||||
Reference in new issue
Block a user