feat: the host's file shares and network mounts, 0.27.0 (NetOrk/netork#3104)
- get_shares() through napalm-device-types' PosixSharesMixin: the NFS exports and Samba shares the host serves, each naming its service. - get_network_mounts() through NetworkMountsMixin: the NFS exports and SMB shares the host has mounted. - Requires napalm-device-types 4.58.0, which also reports nfs-server running while its unit is active and names it as the unit of the kernel's NFS sockets.
This commit is contained in:
1 parent
612bda6ce2
commit
6f073aa96c
4 files changed
+92
-2
No files matched your search
@@ -40,8 +40,10 @@ from napalm_device_types import (
|
||||
HostStatusMixin,
|
||||
KernelFactsMixin,
|
||||
LldpNeighborDict,
|
||||
NetworkMountsMixin,
|
||||
OpenSshServerMixin,
|
||||
OSDriver,
|
||||
PosixSharesMixin,
|
||||
ServiceClustersMixin,
|
||||
ServicePackagesMixin,
|
||||
SnmpAgentMixin,
|
||||
@@ -275,6 +277,8 @@ class LinuxDriver(
|
||||
AptProxyMixin,
|
||||
KernelFactsMixin,
|
||||
ServicePackagesMixin,
|
||||
PosixSharesMixin,
|
||||
NetworkMountsMixin,
|
||||
LinuxProcessReadingsMixin,
|
||||
HostFirewallMixin,
|
||||
VirtualIpsMixin,
|
||||
@@ -1042,6 +1046,20 @@ class LinuxDriver(
|
||||
"""
|
||||
return self.run_command(f"sh -c {_shlex_quote(command)}", timeout=120).stdout
|
||||
|
||||
def _run_shares_command(self, command: str) -> str:
|
||||
"""The transport for ``PosixSharesMixin.get_shares``: the NFS exports and Samba
|
||||
shares the host serves (NetOrk/netork#3104).
|
||||
|
||||
An exec channel under ``sh``, like the service packages. The export table and
|
||||
Samba's configuration are readable to everyone, so never through sudo.
|
||||
"""
|
||||
return self.run_command(f"sh -c {_shlex_quote(command)}", timeout=60).stdout
|
||||
|
||||
def _run_network_mounts_command(self, command: str) -> str:
|
||||
"""The transport for ``NetworkMountsMixin.get_network_mounts``: the NFS exports
|
||||
and SMB shares the host has mounted (NetOrk/netork#3104). Readable by everyone."""
|
||||
return self.run_command(f"sh -c {_shlex_quote(command)}", timeout=30).stdout
|
||||
|
||||
# ------------------------------------------------------------------
|
||||
# HostFirewallMixin – the transport for get_host_firewall
|
||||
# ------------------------------------------------------------------
|
||||
|
||||
Reference in new issue
Block a user