mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
Updated use of tail on Solaris and Sun-like OS
This commit is contained in:
parent
90e6a1d8f6
commit
a6218b9484
1 changed files with 5 additions and 13 deletions
|
@ -216,7 +216,7 @@ def _ppid():
|
|||
'''
|
||||
ret = {}
|
||||
if __grains__['kernel'] == 'SunOS':
|
||||
cmd = 'ps -a -o pid,ppid | tail -n+2'
|
||||
cmd = 'ps -a -o pid,ppid | tail +2'
|
||||
else:
|
||||
cmd = 'ps -ax -o pid,ppid | tail -n+2'
|
||||
out = __salt__['cmd.run'](cmd, python_shell=True)
|
||||
|
@ -309,14 +309,10 @@ def _netstat_sunos():
|
|||
'''
|
||||
log.warning('User and program not (yet) supported on SunOS')
|
||||
|
||||
tailpath = '/usr/xpg4/bin/tail'
|
||||
if not os.path.exists(tailpath):
|
||||
return 'required version of command tail does not exist: {0}'.format(tailpath)
|
||||
|
||||
ret = []
|
||||
for addr_family in ('inet', 'inet6'):
|
||||
# Lookup TCP connections
|
||||
cmd = 'netstat -f {0} -P tcp -an | {1} -n +5'.format(addr_family, tailpath)
|
||||
cmd = 'netstat -f {0} -P tcp -an | tail +5'.format(addr_family)
|
||||
out = __salt__['cmd.run'](cmd, python_shell=True)
|
||||
for line in out.splitlines():
|
||||
comps = line.split()
|
||||
|
@ -328,7 +324,7 @@ def _netstat_sunos():
|
|||
'remote-address': comps[1],
|
||||
'state': comps[6]})
|
||||
# Lookup UDP connections
|
||||
cmd = 'netstat -f {0} -P udp -an | {1} -n +5'.format(addr_family, tailpath)
|
||||
cmd = 'netstat -f {0} -P udp -an | tail +5'.format(addr_family)
|
||||
out = __salt__['cmd.run'](cmd, python_shell=True)
|
||||
for line in out.splitlines():
|
||||
comps = line.split()
|
||||
|
@ -484,12 +480,8 @@ def _netstat_route_sunos():
|
|||
'''
|
||||
Return netstat routing information for SunOS
|
||||
'''
|
||||
tailpath = '/usr/xpg4/bin/tail'
|
||||
if not os.path.exists(tailpath):
|
||||
return 'required version of command tail does not exist: {0}'.format(tailpath)
|
||||
|
||||
ret = []
|
||||
cmd = 'netstat -f inet -rn | {0} -n +5'.format(tailpath)
|
||||
cmd = 'netstat -f inet -rn | tail +5'
|
||||
out = __salt__['cmd.run'](cmd, python_shell=True)
|
||||
for line in out.splitlines():
|
||||
comps = line.split()
|
||||
|
@ -500,7 +492,7 @@ def _netstat_route_sunos():
|
|||
'netmask': '',
|
||||
'flags': comps[2],
|
||||
'interface': comps[5] if len(comps) >= 6 else ''})
|
||||
cmd = 'netstat -f inet6 -rn | {0} -n +5'.format(tailpath)
|
||||
cmd = 'netstat -f inet6 -rn | tail +5'
|
||||
out = __salt__['cmd.run'](cmd, python_shell=True)
|
||||
for line in out.splitlines():
|
||||
comps = line.split()
|
||||
|
|
Loading…
Add table
Reference in a new issue