Merge pull request #44914 from jasperla/status/openbsd/netstat

status.netstats: add OpenBSD support
This commit is contained in:
Nicole Thomas 2017-12-14 09:07:32 -05:00 committed by GitHub
commit a1483af113
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1102,6 +1102,9 @@ def netstats():
.. versionchanged:: 2016.11.4
Added support for AIX
.. versionchanged:: Oxygen
Added support for OpenBSD
CLI Example:
.. code-block:: bash
@ -1139,15 +1142,18 @@ def netstats():
return ret
def freebsd_netstats():
return bsd_netstats()
def bsd_netstats():
'''
freebsd specific netstats implementation
bsd specific netstats implementation
'''
ret = {}
for line in __salt__['cmd.run']('netstat -s').splitlines():
if line.startswith('\t\t'):
continue # Skip, too detailed
if not line.startswith('\t'):
key = line.split()[0]
key = line.split()[0].replace(':', '')
ret[key] = {}
else:
comps = line.split()
@ -1207,7 +1213,8 @@ def netstats():
# dict that returns a function that does the right thing per platform
get_version = {
'Linux': linux_netstats,
'FreeBSD': freebsd_netstats,
'FreeBSD': bsd_netstats,
'OpenBSD': bsd_netstats,
'SunOS': sunos_netstats,
'AIX': aix_netstats,
}