--- pykickstart/commands/authconfig.py | 7 +++++++ pykickstart/commands/deviceprobe.py | 9 ++++++++- pykickstart/commands/displaymode.py | 6 ++++++ pykickstart/commands/interactive.py | 8 +++++++- pykickstart/commands/iscsiname.py | 10 ++++++++-- pykickstart/commands/key.py | 12 +++++++++--- pykickstart/commands/lang.py | 11 +++++++++-- pykickstart/commands/lilocheck.py | 8 +++++++- pykickstart/commands/mediacheck.py | 8 +++++++- pykickstart/commands/skipx.py | 8 +++++++- pykickstart/commands/updates.py | 14 +++++++++++--- pykickstart/commands/zerombr.py | 13 +++++++++++-- 12 files changed, 97 insertions(+), 17 deletions(-) diff --git a/pykickstart/commands/authconfig.py b/pykickstart/commands/authconfig.py index 9af9c0f..e3680f3 100644 --- a/pykickstart/commands/authconfig.py +++ b/pykickstart/commands/authconfig.py @@ -18,6 +18,7 @@ # with the express permission of Red Hat, Inc. # from pykickstart.base import * +from pykickstart.options import * class FC3_Authconfig(KickstartCommand): removedKeywords = KickstartCommand.removedKeywords @@ -25,6 +26,7 @@ class FC3_Authconfig(KickstartCommand): def __init__(self, writePriority=0, *args, **kwargs): KickstartCommand.__init__(self, *args, **kwargs) + self.op = self._getParser() self.authconfig = kwargs.get("authconfig", "") def __str__(self): @@ -35,6 +37,11 @@ class FC3_Authconfig(KickstartCommand): return retval + def _getParser(self): + op = KSOptionParser(lineno=self.lineno) + return op + def parse(self, args): + (opts, extra) = self.op.parse_args(args=args) self.authconfig = self.currentLine[len(self.currentCmd):].strip() return self diff --git a/pykickstart/commands/deviceprobe.py b/pykickstart/commands/deviceprobe.py index 435ff97..bed2b0e 100644 --- a/pykickstart/commands/deviceprobe.py +++ b/pykickstart/commands/deviceprobe.py @@ -20,6 +20,7 @@ import string from pykickstart.base import * +from pykickstart.options import * class FC3_DeviceProbe(KickstartCommand): removedKeywords = KickstartCommand.removedKeywords @@ -27,6 +28,7 @@ class FC3_DeviceProbe(KickstartCommand): def __init__(self, writePriority=0, *args, **kwargs): KickstartCommand.__init__(self, writePriority, *args, **kwargs) + self.op = self._getParser() self.deviceprobe = kwargs.get("deviceprobe", "") def __str__(self): @@ -37,6 +39,11 @@ class FC3_DeviceProbe(KickstartCommand): return retval + def _getParser(self): + op = KSOptionParser(lineno=self.lineno) + return op + def parse(self, args): - self.deviceprove = string.join(args) + (opts, extra) = self.op.parse_args(args=args) + self.deviceprove = string.join(extra) return self diff --git a/pykickstart/commands/displaymode.py b/pykickstart/commands/displaymode.py index 24566f0..3446d03 100644 --- a/pykickstart/commands/displaymode.py +++ b/pykickstart/commands/displaymode.py @@ -27,6 +27,7 @@ class FC3_DisplayMode(KickstartCommand): def __init__(self, writePriority=0, *args, **kwargs): KickstartCommand.__init__(self, writePriority, *args, **kwargs) + self.op = self._getParser() self.displayMode = kwargs.get("displayMode", None) def __str__(self): @@ -44,7 +45,12 @@ class FC3_DisplayMode(KickstartCommand): return retval + def _getParser(self): + op = KSOptionParser(lineno=self.lineno) + return op + def parse(self, args): + (opts, extra) = self.op.parse_args(args=args) if self.currentCmd == "cmdline": self.displayMode = DISPLAY_MODE_CMDLINE elif self.currentCmd == "graphical": diff --git a/pykickstart/commands/interactive.py b/pykickstart/commands/interactive.py index 422491f..c65570a 100644 --- a/pykickstart/commands/interactive.py +++ b/pykickstart/commands/interactive.py @@ -30,6 +30,7 @@ class FC3_Interactive(KickstartCommand): def __init__(self, writePriority=0, *args, **kwargs): KickstartCommand.__init__(self, writePriority, *args, **kwargs) + self.op = self._getParser() self.interactive = kwargs.get("interactive", False) def __str__(self): @@ -40,8 +41,13 @@ class FC3_Interactive(KickstartCommand): return retval + def _getParser(self): + op = KSOptionParser(lineno=self.lineno) + return op + def parse(self, args): - if len(args) > 0: + (opts, extra) = self.op.parse_args(args=args) + if len(extra) > 0: raise KickstartValueError, formatErrorMsg(self.lineno, msg=_("Kickstart command %s does not take any arguments") % "interactive") self.interactive = True diff --git a/pykickstart/commands/iscsiname.py b/pykickstart/commands/iscsiname.py index 8ff9494..e8301bc 100644 --- a/pykickstart/commands/iscsiname.py +++ b/pykickstart/commands/iscsiname.py @@ -31,6 +31,7 @@ class FC6_IscsiName(KickstartCommand): def __init__(self, writePriority=70, *args, **kwargs): KickstartCommand.__init__(self, writePriority, *args, **kwargs) + self.op = self._getParser() self.iscsiname = kwargs.get("iscsiname", "") def __str__(self): @@ -41,8 +42,13 @@ class FC6_IscsiName(KickstartCommand): return retval + def _getParser(self): + op = KSOptionParser(lineno=self.lineno) + return op + def parse(self, args): - if len(args) != 1: + (opts, extra) = self.op.parse_args(args=args) + if len(extra) != 1: raise KickstartValueError, formatErrorMsg(self.lineno, msg=_("Kickstart command %s requires one argument") % "iscsiname") - self.iscsiname = args[0] + self.iscsiname = extra[0] return self diff --git a/pykickstart/commands/key.py b/pykickstart/commands/key.py index 18ab45e..6bc3487 100644 --- a/pykickstart/commands/key.py +++ b/pykickstart/commands/key.py @@ -31,6 +31,7 @@ class F7_Key(KickstartCommand): def __init__(self, writePriority=0, *args, **kwargs): KickstartCommand.__init__(self, writePriority, *args, **kwargs) + self.op = self._getParser() self.key = kwargs.get("key", "") def __str__(self): @@ -43,13 +44,18 @@ class F7_Key(KickstartCommand): return retval + def _getParser(self): + op = KSOptionParser(lineno=self.lineno) + return op + def parse(self, args): - if len(args) != 1: + (opts, extra) = self.op.parse_args(args=args) + if len(extra) != 1: raise KickstartValueError, formatErrorMsg(self.lineno, msg=_("Kickstart command %s requires one argument") % "key") - if args[0] == "--skip": + if extra[0] == "--skip": self.key = KS_INSTKEY_SKIP else: - self.key = args[0] + self.key = extra[0] return self diff --git a/pykickstart/commands/lang.py b/pykickstart/commands/lang.py index 1b8e13a..d89a8a2 100644 --- a/pykickstart/commands/lang.py +++ b/pykickstart/commands/lang.py @@ -19,6 +19,7 @@ # from pykickstart.base import * from pykickstart.errors import * +from pykickstart.options import * import gettext _ = lambda x: gettext.ldgettext("pykickstart", x) @@ -29,6 +30,7 @@ class FC3_Lang(KickstartCommand): def __init__(self, writePriority=0, *args, **kwargs): KickstartCommand.__init__(self, writePriority, *args, **kwargs) + self.op = self._getParser() self.lang = kwargs.get("lang", "") def __str__(self): @@ -39,11 +41,16 @@ class FC3_Lang(KickstartCommand): return retval + def _getParser(self): + op = KSOptionParser(lineno=self.lineno) + return op + def parse(self, args): - if len(args) != 1: + (opts, extra) = self.op.parse_args(args=args) + if len(extra) != 1: raise KickstartValueError, formatErrorMsg(self.lineno, msg=_("Kickstart command %s requires one argument") % "lang") - self.lang = args[0] + self.lang = extra[0] return self def apply(self, instroot="/"): diff --git a/pykickstart/commands/lilocheck.py b/pykickstart/commands/lilocheck.py index ac1f151..827b509 100644 --- a/pykickstart/commands/lilocheck.py +++ b/pykickstart/commands/lilocheck.py @@ -30,6 +30,7 @@ class FC3_LiloCheck(KickstartCommand): def __init__(self, writePriority=0, *args, **kwargs): KickstartCommand.__init__(self, writePriority, *args, **kwargs) + self.op = self._getParser() self.check = kwargs.get("check", False) def __str__(self): @@ -40,8 +41,13 @@ class FC3_LiloCheck(KickstartCommand): return retval + def _getParser(self): + op = KSOptionParser(lineno=self.lineno) + return op + def parse(self, args): - if len(args) > 0: + (opts, extra) = self.op.parse_args(args=args) + if len(extra) > 0: raise KickstartValueError, formatErrorMsg(self.lineno, msg=_("Kickstart command %s does not take any arguments") % "lilocheck") self.check = True diff --git a/pykickstart/commands/mediacheck.py b/pykickstart/commands/mediacheck.py index 2d4de53..aa40e87 100644 --- a/pykickstart/commands/mediacheck.py +++ b/pykickstart/commands/mediacheck.py @@ -30,6 +30,7 @@ class FC4_MediaCheck(KickstartCommand): def __init__(self, writePriority=0, *args, **kwargs): KickstartCommand.__init__(self, writePriority, *args, **kwargs) + self.op = self._getParser() self.mediacheck = kwargs.get("mediacheck", False) def __str__(self): @@ -39,8 +40,13 @@ class FC4_MediaCheck(KickstartCommand): return retval + def _getParser(self): + op = KSOptionParser(lineno=self.lineno) + return op + def parse(self, args): - if len(args) > 0: + (opts, extra) = self.op.parse_args(args=args) + if len(extra) > 0: raise KickstartValueError, formatErrorMsg(self.lineno, msg=_("Kickstart command %s does not take any arguments") % "mediacheck") self.mediacheck = True diff --git a/pykickstart/commands/skipx.py b/pykickstart/commands/skipx.py index 5569f32..3ac0966 100644 --- a/pykickstart/commands/skipx.py +++ b/pykickstart/commands/skipx.py @@ -30,6 +30,7 @@ class FC3_SkipX(KickstartCommand): def __init__(self, writePriority=0, *args, **kwargs): KickstartCommand.__init__(self, writePriority, *args, **kwargs) + self.op = self._getParser() self.skipx = kwargs.get("skipx", False) def __str__(self): @@ -40,8 +41,13 @@ class FC3_SkipX(KickstartCommand): return retval + def _getParser(self): + op = KSOptionParser(lineno=self.lineno) + return op + def parse(self, args): - if len(args) > 0: + (opts, extra) = self.op.parse_args(args=args) + if len(extra) > 0: raise KickstartValueError, formatErrorMsg(self.lineno, msg=_("Kickstart command %s does not take any arguments") % "skipx") self.skipx = True diff --git a/pykickstart/commands/updates.py b/pykickstart/commands/updates.py index 4139f59..b915c59 100644 --- a/pykickstart/commands/updates.py +++ b/pykickstart/commands/updates.py @@ -19,6 +19,7 @@ # from pykickstart.base import * from pykickstart.errors import * +from pykickstart.options import * import gettext _ = lambda x: gettext.ldgettext("pykickstart", x) @@ -29,6 +30,7 @@ class F7_Updates(KickstartCommand): def __init__(self, writePriority=0, *args, **kwargs): KickstartCommand.__init__(self, writePriority, *args, **kwargs) + self.op = self._getParser() self.url = kwargs.get("url", "") def __str__(self): @@ -41,12 +43,18 @@ class F7_Updates(KickstartCommand): return retval + def _getParser(self): + op = KSOptionParser(lineno=self.lineno) + return op + def parse(self, args): - if len(args) > 1: + (opts, extra) = self.op.parse_args(args=args) + + if len(extra) > 1: raise KickstartValueError, formatErrorMsg(self.lineno, msg=_("Kickstart command %s only takes one argument") % "updates") - elif len(args) == 0: + elif len(extra) == 0: self.url = "floppy" else: - self.url = args[0] + self.url = extra[0] return self diff --git a/pykickstart/commands/zerombr.py b/pykickstart/commands/zerombr.py index a97969b..2716777 100644 --- a/pykickstart/commands/zerombr.py +++ b/pykickstart/commands/zerombr.py @@ -31,6 +31,7 @@ class FC3_ZeroMbr(KickstartCommand): def __init__(self, writePriority=110, *args, **kwargs): KickstartCommand.__init__(self, writePriority, *args, **kwargs) + self.op = self._getParser() self.zerombr = kwargs.get("zerombr", False) def __str__(self): @@ -41,8 +42,14 @@ class FC3_ZeroMbr(KickstartCommand): return retval + def _getParser(self): + op = KSOptionParser(lineno=self.lineno) + return op + def parse(self, args): - if len(args) > 0: + (opts, extra) = self.op.parse_args(args=args) + + if len(extra) > 0: warnings.warn(_("Ignoring deprecated option on line %s: The zerombr command no longer takes any options. In future releases, this will result in a fatal error from kickstart. Please modify your kickstart file to remove any options.") % self.lineno, DeprecationWarning) self.zerombr = True @@ -53,7 +60,9 @@ class F9_ZeroMbr(FC3_ZeroMbr): removedAttrs = FC3_ZeroMbr.removedAttrs def parse(self, args): - if len(args) > 0: + (opts, extra) = self.op.parse_args(args=args) + + if len(extra) > 0: raise KickstartValueError, formatErrorMsg(self.lineno, msg=_("Kickstart command %s does not take any arguments") % "zerombr") self.zerombr = True -- 1.6.0.6 _______________________________________________ Kickstart-list mailing list Kickstart-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/kickstart-list