The key command was added for RHEL5, which was shortly after FC6 came out.
[pykickstart.git] / pykickstart / commands / f7.py
blob5716a0d9db337854babc6e85755798ce7d07e70a
2 # Chris Lumens <clumens@redhat.com>
4 # Copyright 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 import string
14 import warnings
16 from pykickstart.constants import *
17 from pykickstart.errors import *
18 from pykickstart.options import *
19 from pykickstart.version import *
21 from rhpl.translate import _
22 import rhpl.translate as translate
24 translate.textdomain("pykickstart")
26 ### INHERIT FROM A PREVIOUS RELEASE
27 from fc6 import *
29 class F7Handler(FC6Handler):
30 ###
31 ### COMMAND CLASSES
32 ###
33 class Key(KickstartCommand):
34 def __init__(self, writePriority=0, key=""):
35 KickstartCommand.__init__(self, writePriority)
36 self.key = key
38 def __str__(self):
39 if self.key == KS_INSTKEY_SKIP:
40 return "key --skip"
41 elif self.key != "":
42 return "key %s" % self.key
43 else:
44 return ""
46 def parse(self, args):
47 if len(args) > 1:
48 raise KickstartValueError, formatErrorMsg(self.lineno, msg=_("Command %s only takes one argument") % "key")
50 if args[0] == "--skip":
51 self.key = KS_INSTKEY_SKIP
52 else:
53 self.key = args[0]
56 ## MAIN
58 def __init__(self):
59 FC6Handler.__init__(self)
60 self.version = F7
62 self.unregisterCommand(self.LangSupport)
63 self.unregisterCommand(self.Mouse)
64 self.registerCommand(self.Key(), ["key"])