1 # Copyright 2008, Red Hat, Inc
2 # Luke Macken <lmacken@redhat.com>
4 # This software may be freely redistributed under the terms of the GNU
5 # general public license.
7 # You should have received a copy of the GNU General Public License
8 # along with this program; if not, write to the Free Software
9 # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
14 class SysctlModule(func_module
.FuncModule
):
17 description
= "Configure kernel parameters at runtime"
20 cmd
= sub_process
.Popen(cmd
.split(), stdout
=sub_process
.PIPE
,
21 stderr
=sub_process
.PIPE
, shell
=False)
22 return [line
for line
in cmd
.communicate()[0].strip().split('\n')]
25 return self
.__run
("/sbin/sysctl -a")
28 return self
.__run
("/sbin/sysctl -n %s" % name
)
30 def set(self
, name
, value
):
31 return self
.__run
("/sbin/sysctl -w %s=%s" % (name
, value
))