2 # Chris Lumens <clumens@redhat.com>
4 # Copyright 2005, 2006, 2007 Red Hat, Inc.
6 # This copyrighted material is made available to anyone wishing to use, modify,
7 # copy, or redistribute it subject to the terms and conditions of the GNU
8 # General Public License v.2. This program is distributed in the hope that it
9 # will be useful, but WITHOUT ANY WARRANTY expressed or implied, including the
10 # implied warranties of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
11 # See the GNU General Public License for more details.
13 # You should have received a copy of the GNU General Public License along with
14 # this program; if not, write to the Free Software Foundation, Inc., 51
15 # Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. Any Red Hat
16 # trademarks that are incorporated in the source code or documentation are not
17 # subject to the GNU General Public License and may only be used or replicated
18 # with the express permission of Red Hat, Inc.
20 from pykickstart
.base
import *
21 from pykickstart
.options
import *
23 from rhpl
.translate
import _
24 import rhpl
.translate
as translate
26 translate
.textdomain("pykickstart")
28 class FC3_Device(KickstartCommand
):
29 def __init__(self
, writePriority
=0, type="", moduleName
="", moduleOpts
=""):
30 KickstartCommand
.__init
__(self
, writePriority
)
32 self
.moduleName
= moduleName
33 self
.moduleOpts
= moduleOpts
36 if self
.moduleName
!= "":
37 if self
.moduleOpts
!= "":
38 retval
= "--opts=%s" % self
.moduleOpts
42 return "device %s %s %s\n" % (self
.type, self
.moduleName
, retval
)
46 def parse(self
, args
):
47 op
= KSOptionParser(lineno
=self
.lineno
)
48 op
.add_option("--opts", dest
="moduleOpts", default
="")
50 (opts
, extra
) = op
.parse_args(args
=args
)
53 raise KickstartValueError
, formatErrorMsg(self
.lineno
, msg
=_("device command requires two arguments: module type and name"))
55 self
.opts
= opts
.moduleOpts
57 self
.moduleName
= extra
[1]
59 class F8_Device(KickstartCommand
):
60 def __init__(self
, writePriority
=0, moduleName
="", moduleOpts
=""):
61 KickstartCommand
.__init
__(self
, writePriority
)
62 self
.moduleName
= moduleName
63 self
.moduleOpts
= moduleOpts
66 if self
.moduleName
!= "":
67 if self
.moduleOpts
!= "":
68 retval
= "--opts=%s" % self
.moduleOpts
72 return "device %s %s\n" % (self
.moduleName
, retval
)
76 def parse(self
, args
):
77 op
= KSOptionParser(lineno
=self
.lineno
)
78 op
.add_option("--opts", dest
="moduleOpts", default
="")
80 (opts
, extra
) = op
.parse_args(args
=args
)
83 raise KickstartValueError
, formatErrorMsg(self
.lineno
, msg
=_("%s command requires a single argument: %s") % ("device", "module name"))
85 self
.opts
= opts
.moduleOpts
86 self
.moduleName
= extra
[1]