feat(log-sources): which logs the host writes, through LogSourcesMixin
driver / standard (pull_request) Failing after 18s
driver / lint (pull_request) Successful in 16s
driver / test (3.12) (pull_request) Failing after 46s
driver / types (pull_request) Failing after 1m3s
driver / test (3.13) (pull_request) Failing after 40s
driver / lowest (pull_request) Failing after 23s
driver / build (pull_request) Successful in 32s
driver / security (pull_request) Failing after 1m1s
CI / driver (pull_request) Failing after 2m22s
driver / publish (pull_request) Skipped

The driver mixes in napalm-device-types' LogSourcesMixin (4.30.0) and
carries its command: as root through sudo where it can, else what the
login user may see. OpenMediaVault and QNAP inherit it.

Refs NetOrk/netork#2049
This commit is contained in:
Christian Manivong committed 2026-11-05 00:24:32 +01:00
1 parent 249046512d
commit 2b153cd61c
4 files changed
+68 -1

No files matched your search

+11
View File
@@ -40,6 +40,7 @@ from napalm_device_types import (
KernelFactsMixin,
ListeningSocketsMixin,
LldpNeighborDict,
LogSourcesMixin,
OpenSshServerMixin,
OSDriver,
PosixScheduledJobsMixin,
@@ -304,6 +305,7 @@ class LinuxDriver(
KernelFactsMixin,
ServicePackagesMixin,
ListeningSocketsMixin,
LogSourcesMixin,
HostFirewallMixin,
VirtualIpsMixin,
ServiceClustersMixin,
@@ -1098,6 +1100,15 @@ class LinuxDriver(
return self._run_privileged(command, 60)
return self._send(command, read_timeout=60)
def _run_log_sources_command(self, command: str, *, privileged: bool) -> str:
"""The transport for ``LogSourcesMixin.get_log_sources``.
Read-only either way; root only so that every process shows its open files.
"""
if privileged:
return self._run_privileged(command, 60)
return self._send(command, read_timeout=60)
def _run_host_firewall_command(self, command: str, *, privileged: bool) -> str:
"""The transport for ``HostFirewallMixin.get_host_firewall``: an exec channel.