Merge pull request #35325 from kev009/fbsd-netstat-route

Fix freebsd netstat route on fbsd 10+
This commit is contained in:
Mike Place 2016-08-10 20:33:12 +09:00 committed by GitHub
commit cfae862972

View file

@ -385,13 +385,22 @@ def _netstat_route_freebsd():
out = __salt__['cmd.run'](cmd, python_shell=True)
for line in out.splitlines():
comps = line.split()
ret.append({
'addr_family': 'inet',
'destination': comps[0],
'gateway': comps[1],
'netmask': comps[2],
'flags': comps[3],
'interface': comps[5]})
if __grains__['os'] == 'FreeBSD' and __grains__.get('osmajorrelease', 0) < 10:
ret.append({
'addr_family': 'inet',
'destination': comps[0],
'gateway': comps[1],
'netmask': comps[2],
'flags': comps[3],
'interface': comps[5]})
else:
ret.append({
'addr_family': 'inet',
'destination': comps[0],
'gateway': comps[1],
'netmask': '',
'flags': comps[2],
'interface': comps[3]})
cmd = 'netstat -f inet6 -rn | tail -n+5'
out = __salt__['cmd.run'](cmd, python_shell=True)
for line in out.splitlines():