mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
Adding sysctl module, with list functionality (so far)
This commit is contained in:
parent
d75f9500af
commit
d3f8183252
1 changed files with 23 additions and 0 deletions
23
salt/modules/sysctl.py
Normal file
23
salt/modules/sysctl.py
Normal file
|
@ -0,0 +1,23 @@
|
|||
'''
|
||||
Module for viewing and modifying sysctl paramters
|
||||
'''
|
||||
import subprocess
|
||||
|
||||
def list():
|
||||
'''
|
||||
Return a list of sysctl parameters for this minion
|
||||
|
||||
CLI Example:
|
||||
salt '*' sysctl.list
|
||||
'''
|
||||
cmd = 'sysctl -a'
|
||||
ret = {}
|
||||
out = subprocess.Popen(cmd,
|
||||
shell=True,
|
||||
stdout=subprocess.PIPE).communicate()[0].split('\n')
|
||||
for line in out:
|
||||
if not line.count(' '):
|
||||
continue
|
||||
comps = line.split(' = ')
|
||||
ret[comps[0]] = comps[1]
|
||||
return ret
|
Loading…
Add table
Reference in a new issue