Don't set any default values on these commands.
[pykickstart.git] / pykickstart / commands / selinux.py
blobcc44faccaa1011bf81461e444e450b25308cae0d
2 # Chris Lumens <clumens@redhat.com>
4 # Copyright 2005, 2006, 2007 Red Hat, Inc.
6 # This software may be freely redistributed under the terms of the GNU
7 # general public license.
9 # You should have received a copy of the GNU General Public License
10 # along with this program; if not, write to the Free Software
11 # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
13 from pykickstart.base import *
14 from pykickstart.constants import *
15 from pykickstart.options import *
17 class FC3_SELinux(KickstartCommand):
18 def __init__(self, writePriority=0, selinux=None):
19 KickstartCommand.__init__(self, writePriority)
20 self.selinux = selinux
22 def __str__(self):
23 retval = "# SELinux configuration\n"
25 if self.selinux == SELINUX_DISABLED:
26 return retval + "selinux --disabled\n"
27 elif self.selinux == SELINUX_ENFORCING:
28 return retval + "selinux --enforcing\n"
29 elif self.selinux == SELINUX_PERMISSIVE:
30 return retval + "selinux --permissive\n"
31 else:
32 return ""
34 def parse(self, args):
35 op = KSOptionParser(lineno=self.lineno)
36 op.add_option("--disabled", dest="sel", action="store_const",
37 const=SELINUX_DISABLED)
38 op.add_option("--enforcing", dest="sel", action="store_const",
39 const=SELINUX_ENFORCING)
40 op.add_option("--permissive", dest="sel", action="store_const",
41 const=SELINUX_PERMISSIVE)
43 (opts, extra) = op.parse_args(args=args)
44 self.selinux = opts.sel