of objects (like partitions, network devices, etc.) and need to populate
a Data object.
"""
- for (key, val) in list(vars(namespace).items()):
+ for (key, val) in vars(namespace).items():
if val is not None:
setattr(obj, key, val)
If partitioning fails for any reason, diagnostic
messages will appear on virtual console 3.""",
version=FC3)
- op.add_argument("mntpoint", metavar="<mntpoint>", type=mountpoint, nargs=1,
- version=FC3, help="""
- The ``<mntpoint>`` is where the partition will be mounted
- and must be of one of the following forms:
-
- ``/<path>``
-
- For example, ``/``, ``/usr``, ``/home``
-
- ``swap``
-
- The partition will be used as swap space.
-
- ``raid.<id>``
-
- The partition will be used for software RAID.
- Refer to the ``raid`` command.
-
- ``pv.<id>``
-
- The partition will be used for LVM. Refer to the
- ``logvol`` command.
-
- ``btrfs.<id>``
-
- The partition will be used for BTRFS volume. Rerefer to
- the ``btrfs`` command.
-
- ``biosboot``
-
- The partition will be used for a BIOS Boot Partition. As
- of Fedora 16 there must be a biosboot partition for the
- bootloader to be successfully installed onto a disk that
- contains a GPT/GUID partition table. Rerefer to the
- ``bootloader`` command.
- """)
op.add_argument("--active", action="store_true", default=False,
version=FC3, help="Set partition as active")
op.add_argument("--asprimary", dest="primOnly", action="store_true",
return op
def parse(self, args):
- (opts, extra) = self.op.parse_args(args=args, lineno=self.lineno)
+ (ns, extra) = self.op.parse_known_args(args=args, lineno=self.lineno)
pd = self.dataClass() # pylint: disable=not-callable
self.set_to_obj(ns, pd)
warnings.warn(_("A partition with the mountpoint %s has already been defined.") % pd.mountpoint)
else:
pd.mountpoint = None
-
return pd
def dataList(self):
help="""
Name of the newly created snapshot.""")
# Show all possible options in meta message
- meta_msg = "<%s>" % ("|".join(list(self.whenMap.keys())))
+ meta_msg = "<%s>" % ("|".join(self.whenMap.keys()))
op.add_argument("--when", metavar=meta_msg, type=self._when_cb, version=F26,
required=True, help="""
You can specify two possible values: ``pre-install`` and ``post-install``.
raise KickstartParseError(msg, lineno=self.lineno)
# Check if value in a '--when' param is valid
- if snap_data.when != "" and snap_data.when not in list(self.whenMap.values()):
+ if snap_data.when != "" and snap_data.when not in self.whenMap.values():
msg = (_("Snapshot when param must have one of these values %s!") %
- list(self.whenMap.keys()))
+ self.whenMap.keys())
raise KickstartParseError(msg, lineno=self.lineno)
return snap_data
for arg in args:
for option, new_option in \
- list({"--instLangs": "--inst-langs", "--excludeWeakdeps": "--exclude-weakdeps"}.items()):
+ {"--instLangs": "--inst-langs", "--excludeWeakdeps": "--exclude-weakdeps"}.items():
if option in arg:
warnings.warn(_("The %(option)s option on line %(lineno)s will be deprecated in "
"future releases. Please modify your kickstart file to replace "
if args.block_recommends:
configmgr.create['block_recommends']=args.block_recommends
-if args.runtime:
+ if args.runtime:
configmgr.set_runtime(args.runtime)
if args.use_mic_in_bootstrap:
from pykickstart.errors import *
from pykickstart.options import *
from pykickstart.version import DEVEL
+from pykickstart.i18n import _
class Mic_Desktop(KickstartCommand):
def __init__(self, writePriority=0,
defaultdm=None,
autologinuser=None,
session=None):
-
KickstartCommand.__init__(self, writePriority)
- self.__new_version = False
self.op = self._getParser()
self.defaultdesktop = defaultdesktop
return retval
def _getParser(self):
- try:
- #ingnore this pylit error, the lineno argument exist in olg version. using this way can compate old version.
- op = KSOptionParser(prog='desktop', description='desktop', version=DEVEL, lineno=self.lineno) #pylint: disable=unexpected-keyword-arg
- except TypeError:
- # the latest version has not lineno argument
- op = KSOptionParser(prog='desktop', description='desktop', version=DEVEL)
- self.__new_version = True
-
+ op = KSOptionParser(prog='desktop', description='desktop', version=DEVEL)
op.add_argument("--defaultdesktop", dest="defaultdesktop",
action="store",
type=str,
return op
def parse(self, args):
- if self.__new_version:
- (opts, extra) = self.op.parse_args(args=args, lineno=self.lineno)
- else:
- (opts, extra) = self.op.parse_args(args=args)
-
- if extra:
- m = ("Unexpected arguments to %(command)s command: %(options)s") \
- % {"command": "desktop", "options": extra}
- raise KickstartValueError (formatErrorMsg(self.lineno, msg=m))
- self._setToSelf(self.op, opts)
+ (ns, extra) = self.op.parse_known_args(args=args, lineno=self.lineno)
+ if any(arg for arg in extra if arg.startswith("-")):
+ mapping = {"command": "desktop", "options": extra}
+ raise KickstartParseError(_("Unexpected arguments to %(command)s command: %(options)s") % mapping, lineno=self.lineno)
+ self.set_to_self(ns)
from mic import msger
from pykickstart.version import DEVEL
+from pykickstart.i18n import _
+
class Mic_installerfw(KickstartCommand):
""" This class implements the "installerfw_plugins" KS option. The argument
of the option is a comman-separated list of MIC features which have to be
return op
def parse(self, args):
- (_, extra) = self.op.parse_args(args=args, lineno=self.lineno)
+ print("NNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN")
+ (ns, extra) = self.op.parse_known_args(args=args, lineno=self.lineno)
+ self.set_to_self(ns)
if len(extra) != 1:
- msg = "Kickstart command \"%s\" requires one " \
- "argumet - a list of legacy features to disable" % self.currentCmd
- raise KickstartValueError (formatErrorMsg(self.lineno, msg = msg))
-
- self.features = extra[0].split(",")
+ raise KickstartParseError(_("Kickstart command %s requires one argument") % "installerfw", lineno=self.lineno)
+ elif any(arg for arg in extra if arg.startswith("-")):
+ mapping = {"command": "installerfw", "options": extra}
+ raise KickstartParseError(_("Unexpected arguments to %(command)s command: %(options)s") % mapping, lineno=self.lineno)
+ else:
+ self.features = extra[0].split(",")
return self