From ddb4a94386496c9fafda8787c59f0420523df892 Mon Sep 17 00:00:00 2001 From: Chris Lumens Date: Mon, 1 Oct 2007 18:56:52 +0000 Subject: [PATCH] Add a new version of the device command that does not take a type argument. --- ChangeLog | 4 ++++ pykickstart/commands/device.py | 29 +++++++++++++++++++++++++++++ pykickstart/handlers/control.py | 2 +- 3 files changed, 34 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 8589b2b..0575301 100644 --- a/ChangeLog +++ b/ChangeLog @@ -2,6 +2,10 @@ * po/sr@latin.po: Renamed from sr@Latn.po (#259121). + * pykickstart/commands/device.py (F8_Device): Add a new version of + the device command that does not take a type argument. + * pykickstart/handlers/control.py: Use F8_Device for Fedora 8. + 2007-09-28 Chris Lumens * pykickstart.spec, setup.py: New version. diff --git a/pykickstart/commands/device.py b/pykickstart/commands/device.py index 1980a52..aec0960 100644 --- a/pykickstart/commands/device.py +++ b/pykickstart/commands/device.py @@ -55,3 +55,32 @@ class FC3_Device(KickstartCommand): self.opts = opts.moduleOpts self.type = extra[0] self.moduleName = extra[1] + +class F8_Device(KickstartCommand): + def __init__(self, writePriority=0, moduleName="", moduleOpts=""): + KickstartCommand.__init__(self, writePriority) + self.moduleName = moduleName + self.moduleOpts = moduleOpts + + def __str__(self): + if self.moduleName != "": + if self.moduleOpts != "": + retval = "--opts=%s" % self.moduleOpts + else: + retval = "" + + return "device %s %s\n" % (self.moduleName, retval) + else: + return "" + + def parse(self, args): + op = KSOptionParser(lineno=self.lineno) + op.add_option("--opts", dest="moduleOpts", default="") + + (opts, extra) = op.parse_args(args=args) + + if len(extra) != 1: + raise KickstartValueError, formatErrorMsg(self.lineno, msg=_("%s command requires a single argument: %s") % ("device", "module name")) + + self.opts = opts.moduleOpts + self.moduleName = extra[1] diff --git a/pykickstart/handlers/control.py b/pykickstart/handlers/control.py index a70cbc4..994bf29 100644 --- a/pykickstart/handlers/control.py +++ b/pykickstart/handlers/control.py @@ -303,7 +303,7 @@ commandMap = { "cdrom": method.FC6_Method, "clearpart": clearpart.FC3_ClearPart, "cmdline": displaymode.FC3_DisplayMode, - "device": device.FC3_Device, + "device": device.F8_Device, "deviceprobe": deviceprobe.FC3_DeviceProbe, "dmraid": dmraid.FC6_DmRaid, "driverdisk": driverdisk.FC3_DriverDisk, -- 2.11.4.GIT