def handle_header(self, lineno, args):
        """
        The handle_header method is called to parse additional arguments in the
        %addon section line.

        args is a list of all the arguments following the addon ID. For
        example, for the line:
        
            %addon org_fedora_hello_world --reverse --arg2="example"

        handle_header will be called with args=['--reverse', '--arg2="example"']

        :param lineno: the current line number in the kickstart file
        :type lineno: int
        :param args: the list of arguments from the %addon line
        :type args: list
        """

        op = KSOptionParser()
        op.add_option("--reverse", action="store_true", default=False,
                dest="reverse", help="Reverse the display of the addon text")
        (opts, extra) = op.parse_args(args=args, lineno=lineno)
        
        # Reject any additional arguments. Since AddonData.handle_header
        # rejects any arguments, we can use it to create an error message
        # and raise an exception.
        if extra:
            AddonData.handle_header(self, lineno, args)

        # Store the result of the option parsing
        self.reverse = opts.reverse
Ejemplo n.º 2
0
    def _getParser(self):
        op = KSOptionParser()
        op.add_option("--biospart", dest="biospart")
        op.add_option("--partition", dest="partition")
        op.add_option("--dir", dest="dir", required=1)

        return op
Ejemplo n.º 3
0
 def _getParser(self):
     op = KSOptionParser()
     op.add_option("--add-boot",
                   action="store_true",
                   dest="addBoot",
                   default=False)
     return op
Ejemplo n.º 4
0
    def handle_header(self, lineno, args):
        """
        The handle_header method is called to parse additional arguments in the
        %addon section line.

        args is a list of all the arguments following the addon ID. For
        example, for the line:

            %addon org_fedora_hello_world --reverse --arg2="example"

        handle_header will be called with args=['--reverse', '--arg2="example"']

        :param lineno: the current line number in the kickstart file
        :type lineno: int
        :param args: the list of arguments from the %addon line
        :type args: list
        """

        op = KSOptionParser()
        op.add_option("--reverse", action="store_true", default=False,
                dest="reverse", help="Reverse the display of the addon text")
        (opts, extra) = op.parse_args(args=args, lineno=lineno)

        # Reject any additional arguments.
        if extra:
            msg = "Unhandled arguments on %%addon line for %s" % self.name
            if lineno != None:
                raise KickstartParseError(formatErrorMsg(lineno, msg=msg))
            else:
                raise KickstartParseError(msg)

        # Store the result of the option parsing
        self.reverse = opts.reverse
Ejemplo n.º 5
0
    def _getParser(self):
        op = KSOptionParser()
        # people would struggle remembering the exact word
        op.add_option("--agreed", "--agree", "--accepted", "--accept",
                      dest="agreed", action="store_true", default=False)

        return op
Ejemplo n.º 6
0
 def _getParser(self):
     op = KSOptionParser()
     op.add_option("--name", dest="name", action="store", type="string",
                   required=1)
     op.add_option("--dev", dest="devices", action="append", type="string",
                   required=1)
     return op
Ejemplo n.º 7
0
 def _getParser(self):
     op = KSOptionParser()
     op.add_option("--autoscreenshot",
                   dest="autoscreenshot",
                   action="store_true",
                   default=False)
     return op
Ejemplo n.º 8
0
    def handle_header(self, lineno, args):
        """
        The handle_header method is called to parse additional arguments in the
        %addon section line.

        args is a list of all the arguments following the addon ID. For
        example, for the line:

            %addon org_fedora_hello_world --reverse --arg2="example"

        handle_header will be called with args=['--reverse', '--arg2="example"']

        :param lineno: the current line number in the kickstart file
        :type lineno: int
        :param args: the list of arguments from the %addon line
        :type args: list
        """

        op = KSOptionParser()
        op.add_option("--reverse", action="store_true", default=False,
                dest="reverse", help="Reverse the display of the addon text")
        (opts, extra) = op.parse_args(args=args, lineno=lineno)

        # Reject any additional arguments.
        if extra:
            msg = "Unhandled arguments on %%addon line for %s" % self.name
            if lineno != None:
                raise KickstartParseError(formatErrorMsg(lineno, msg=msg))
            else:
                raise KickstartParseError(msg)

        # Store the result of the option parsing
        self.reverse = opts.reverse
Ejemplo n.º 9
0
 def _getParser(self):
     op = KSOptionParser()
     op.add_option("--name", dest="name", action="store", type="string",
                   required=1)
     op.add_option("--dev", dest="devices", action="append", type="string",
                   required=1)
     return op
Ejemplo n.º 10
0
 def _getParser(self):
     op = KSOptionParser()
     op.add_option("--device", dest="device", default="")
     op.add_option("--emulthree",
                   dest="emulthree",
                   default=False,
                   action="store_true")
     return op
Ejemplo n.º 11
0
    def _getParser(self):
        def drive_cb (option, opt_str, value, parser):
            for d in value.split(','):
                parser.values.ensure_value(option.dest, []).append(d)

        op = KSOptionParser()
        op.add_option("--drives", dest="ignoredisk", action="callback",
                      callback=drive_cb, nargs=1, type="string", required=1)
        return op
Ejemplo n.º 12
0
    def _getParser(self):
        def drive_cb (option, opt_str, value, parser):
            for d in value.split(','):
                parser.values.ensure_value(option.dest, []).append(d)

        op = KSOptionParser()
        op.add_option("--drives", dest="ignoredisk", action="callback",
                      callback=drive_cb, nargs=1, type="string", required=1)
        return op
Ejemplo n.º 13
0
    def _getParser(self):
        def services_cb (option, opt_str, value, parser):
            for d in value.split(','):
                parser.values.ensure_value(option.dest, []).append(d.strip())

        op = KSOptionParser()
        op.add_option("--disabled", dest="disabled", action="callback",
                      callback=services_cb, nargs=1, type="string")
        op.add_option("--enabled", dest="enabled", action="callback",
                      callback=services_cb, nargs=1, type="string")
        return op
Ejemplo n.º 14
0
 def _getParser(self):
     op = KSOptionParser()
     op.add_option("--nomount",
                   dest="nomount",
                   action="store_true",
                   default=False)
     op.add_option("--romount",
                   dest="romount",
                   action="store_true",
                   default=False)
     return op
Ejemplo n.º 15
0
    def _getParser(self):
        def services_cb (option, opt_str, value, parser):
            for d in value.split(','):
                parser.values.ensure_value(option.dest, []).append(d.strip())

        op = KSOptionParser()
        op.add_option("--disabled", dest="disabled", action="callback",
                      callback=services_cb, nargs=1, type="string")
        op.add_option("--enabled", dest="enabled", action="callback",
                      callback=services_cb, nargs=1, type="string")
        return op
Ejemplo n.º 16
0
    def _getParser(self):
        op = KSOptionParser()
        # people would struggle remembering the exact word
        op.add_option("--agreed",
                      "--agree",
                      "--accepted",
                      "--accept",
                      dest="agreed",
                      action="store_true",
                      default=False)

        return op
Ejemplo n.º 17
0
    def handle_header(self, lineno, args):

        op = KSOptionParser()
        op.add_option("--enable", "-e", action="store_true", default=False,
                      dest="state", help="Enable Cloud Support")
        op.add_option("--disable", "-d", action="store_false",
                      dest="state", help="(Default) Disable Cloud Support")
        op.add_option("--allinone", "-a", action="store_true", default=False,
                      dest="mode", help="Specify the mode of Packstack Installation")
        op.add_option("--answer-file", "-f", action="store", type="string",
                      dest="file", help="Specify URL of answers file")
        (options, extra) = op.parse_args(args=args, lineno=lineno)

        # Error Handling
        if str(options.state) == "True":
            self.state = str(options.state)
            if options.file and options.mode:
                msg = "options --allinone and --answer-file are mutually exclusive"
                raise KickstartParseError(msg)
            elif options.file:
                try:
                    response = urllib2.urlopen(options.file)
                    for line in response:
                        self.lines += line
                except urllib2.HTTPError, e:
                    msg = "Kickstart Error:: HTTPError: " + str(e.code)
                    raise KickstartParseError, formatErrorMsg(lineno, msg=msg)
                except urllib2.URLError, e:
                    msg = "Kickstart Error: HTTPError: " + str(e.reason)
                    raise KickstartParseError, formatErrorMsg(lineno, msg=msg)
                except:
Ejemplo n.º 18
0
 def _getParser(self):
     op = KSOptionParser()
     op.add_option("--url", required=1)
     op.add_option("--proxy")
     op.add_option("--noverifyssl", action="store_true", default=False)
     op.add_option("--checksum")
     return op
Ejemplo n.º 19
0
    def _getParser(self):
        try:
            op = KSOptionParser(lineno=self.lineno)
        except TypeError:
            # the latest version has not lineno argument
            op = KSOptionParser()
            self.__new_version = True

        op.add_option(
            "--defaultdesktop",
            dest="defaultdesktop",
            action="store",
            type="string",
            nargs=1)
        op.add_option(
            "--autologinuser",
            dest="autologinuser",
            action="store",
            type="string",
            nargs=1)
        op.add_option(
            "--defaultdm",
            dest="defaultdm",
            action="store",
            type="string",
            nargs=1)
        op.add_option(
            "--session",
            dest="session",
            action="store",
            type="string",
            nargs=1)
        return op
Ejemplo n.º 20
0
 def _getParser(self):
     op = KSOptionParser()
     op.add_option("--url", required=1)
     op.add_option("--proxy")
     op.add_option("--noverifyssl", action="store_true", default=False)
     op.add_option("--checksum")
     return op
Ejemplo n.º 21
0
    def _getParser(self):
        try:
            op = KSOptionParser(lineno=self.lineno)
        except TypeError:
            # the latest version has not lineno argument
            op = KSOptionParser()
            self.__new_version = True

        op.add_option("--defaultdesktop",
                      dest="defaultdesktop",
                      action="store",
                      type="string",
                      nargs=1)
        op.add_option("--autologinuser",
                      dest="autologinuser",
                      action="store",
                      type="string",
                      nargs=1)
        op.add_option("--defaultdm",
                      dest="defaultdm",
                      action="store",
                      type="string",
                      nargs=1)
        op.add_option("--session",
                      dest="session",
                      action="store",
                      type="string",
                      nargs=1)
        return op
Ejemplo n.º 22
0
 def _getParser(self):
     op = KSOptionParser()
     op.add_option("--osname", dest="osname", required=1)
     op.add_option("--remote", dest="remote")
     op.add_option("--url", dest="url", required=1)
     op.add_option("--ref", dest="ref", required=1)
     op.add_option("--nogpg", action="store_true")
     return op
Ejemplo n.º 23
0
 def _getParser(self):
     op = KSOptionParser()
     op.add_option("--username", dest="username", required=True)
     op.add_option("--iscrypted", dest="isCrypted", action="store_true",
                   default=False)
     op.add_option("--plaintext", dest="isCrypted", action="store_false")
     op.add_option("--lock", dest="lock", action="store_true", default=False)
     return op
Ejemplo n.º 24
0
 def _getParser(self):
     op = KSOptionParser()
     op.add_option("--osname", dest="osname", required=1)
     op.add_option("--remote", dest="remote")
     op.add_option("--url", dest="url", required=1)
     op.add_option("--ref", dest="ref", required=1)
     op.add_option("--nogpg", action="store_true")
     return op
Ejemplo n.º 25
0
 def _getParser(self):
     op = KSOptionParser()
     op.add_option("--devnum", dest="devnum", required=1)
     op.add_option("--fcplun", dest="fcplun", required=1)
     op.add_option("--scsiid", dest="scsiid", required=1)
     op.add_option("--scsilun", dest="scsilun", required=1)
     op.add_option("--wwpn", dest="wwpn", required=1)
     return op
Ejemplo n.º 26
0
 def handle_header(self, lineno, args):
     op = KSOptionParser()
     op.add_option("--yubikey",
                   action="store_true",
                   default=False,
                   dest="yubikey",
                   help="")
     op.add_option("--passphrase",
                   action="store_true",
                   default="",
                   dest="passphrase",
                   help="")
     (opts, extra) = op.parse_args(args=args, lineno=lineno)
     self.yubikey = opts.yubikey
     self.passphrase = opts.passphrase
Ejemplo n.º 27
0
    def _getParser(self):
        def drive_cb (option, opt_str, value, parser):
            for d in value.split(','):
                parser.values.ensure_value(option.dest, []).append(d)

        op = KSOptionParser()
        op.add_option("--all", dest="type", action="store_const",
                      const=CLEARPART_TYPE_ALL)
        op.add_option("--drives", dest="drives", action="callback",
                      callback=drive_cb, nargs=1, type="string")
        op.add_option("--initlabel", dest="initAll", action="store_true",
                      default=False)
        op.add_option("--linux", dest="type", action="store_const",
                      const=CLEARPART_TYPE_LINUX)
        op.add_option("--none", dest="type", action="store_const",
                      const=CLEARPART_TYPE_NONE)
        return op
Ejemplo n.º 28
0
    def _getParser(self):
        def when_cb(option, opt_str, value, parser):
            if value.lower() in self.whenMap:
                parser.values.ensure_value(option.dest,
                                           self.whenMap[value.lower()])

        op = KSOptionParser()

        op.add_option("--name", dest="name", required=True, type="string")
        op.add_option("--when",
                      action="callback",
                      callback=when_cb,
                      dest="when",
                      required=True,
                      type="string")

        return op
Ejemplo n.º 29
0
 def _getParser(self):
     op = KSOptionParser()
     op.add_option("--target", dest="target", action="store", type="string")
     op.add_option("--ipaddr", dest="ipaddr", action="store", type="string",
                   required=1)
     op.add_option("--port", dest="port", action="store", type="string")
     op.add_option("--user", dest="user", action="store", type="string")
     op.add_option("--password", dest="password", action="store",
                   type="string")
     return op
Ejemplo n.º 30
0
    def _getParser(self):
        def devs_cb (option, opt_str, value, parser):
            for d in value.split(','):
                parser.values.ensure_value(option.dest, []).append(d)

        op = KSOptionParser()
        op.add_option("--namespace", dest="namespace")
        op.add_option("--blockdevs", metavar="<devspec1>,<devspec2>,...,<devspecN>",
                      action="callback", callback=devs_cb, nargs=1, type="string")
        op.add_option("--mode", choices=self.validModes, default=NVDIMM_MODE_SECTOR, dest="mode")
        op.add_option("--sectorsize", type=int)
        return op
Ejemplo n.º 31
0
 def _getParser(self):
     op = KSOptionParser()
     op.add_option("--username", dest="username", required=True)
     op.add_option("--iscrypted",
                   dest="isCrypted",
                   action="store_true",
                   default=False)
     op.add_option("--plaintext", dest="isCrypted", action="store_false")
     op.add_option("--lock",
                   dest="lock",
                   action="store_true",
                   default=False)
     return op
Ejemplo n.º 32
0
    def handle_header(self, lineno, args):
        """ Handle the kickstart addon header

        :param lineno: Line number
        :param args: arguments from %addon line
        """
        # This gets called after __init__, very early in the installation.
        op = KSOptionParser()
        op.add_option("--vgname",
                      help="Name of the VG that contains a thinpool named docker-pool")
        op.add_option("--fstype",
                      help="Type of filesystem for docker to use with the docker-pool")
        op.add_option("--overlay", action="store_true",
                      help="Use the overlay driver")
        op.add_option("--btrfs", action="store_true",
                      help="Use the BTRFS driver")
        op.add_option("--save-args", action="store_true", default=False,
                      help="Save all extra args to the OPTIONS variable in /etc/sysconfig/docker")
        (opts, extra) = op.parse_args(args=args, lineno=lineno)

        if sum(1 for v in [opts.overlay, opts.btrfs, opts.vgname] if bool(v)) != 1:
            raise KickstartParseError(formatErrorMsg(lineno,
                                                     msg=_("%%addon com_redhat_docker must choose one of --overlay, --btrfs, or --vgname")))

        self.enabled = True
        self.extra_args = extra
        self.save_args = opts.save_args

        if opts.overlay:
            self.storage = OverlayStorage(self)
        elif opts.btrfs:
            self.storage = BTRFSStorage(self)
        elif opts.vgname:
            fmt = blivet.formats.get_format(opts.fstype)
            if not fmt or fmt.type is None:
                raise KickstartParseError(formatErrorMsg(lineno,
                                                         msg=_("%%addon com_redhat_docker fstype of %s is invalid.")) % opts.fstype)

            self.vgname = opts.vgname
            self.fstype = opts.fstype
            self.storage = LVMStorage(self)
Ejemplo n.º 33
0
    def handle_header(self, lineno, args):
        """ Handle the kickstart addon header

        :param lineno: Line number
        :param args: arguments from %addon line
        """
        # This gets called after __init__, very early in the installation.
        op = KSOptionParser()
        op.add_option("--vgname", required=True,
                      help="Name of the VG that contains a thinpool named docker-pool")
        op.add_option("--fstype", required=True,
                      help="Type of filesystem to use for docker to use with docker-pool")
        op.add_option("--save-args", action="store_true", default=False,
                      help="Save all extra args to the OPTIONS variable in /etc/sysconfig/docker")
        (opts, extra) = op.parse_args(args=args, lineno=lineno)

        fmt = blivet.formats.getFormat(opts.fstype)
        if not fmt or fmt.type is None:
            raise KickstartValueError(formatErrorMsg(lineno,
                                      msg=_("%%addon com_redhat_docker fstype of %s is invalid.")) % opts.fstype)

        self.vgname = opts.vgname
        self.fstype = opts.fstype
        self.enabled = True
        self.extra_args = extra
        self.save_args = opts.save_args
Ejemplo n.º 34
0
    def handle_header(self, lineno, args):
        op = KSOptionParser()
        op.add_option("--enable", action="store_true", default=True,
                dest="enabled", help="Enable kdump")
        op.add_option("--disable", action="store_false",
                dest="enabled", help="Disable kdump")
        op.add_option("--reserve-mb", type="string", dest="reserveMB",
                default="auto", help="Amount of memory in MB to reserve for kdump, or auto")

        (opts, extra) = op.parse_args(args=args, lineno=lineno)

        # Reject any additional arguments
        if extra:
            AddonData.handle_header(self, lineno, extra)

        # Validate the reserve-mb argument
        if opts.reserveMB != "auto":
            # Allow a final 'M' for consistency with the crashkernel kernel
            # parameter. Strip it if found.
            if opts.reserveMB and opts.reserveMB[-1] == 'M':
                opts.reserveMB = opts.reserveMB[:-1]

            try:
                _test = int(opts.reserveMB)
            except ValueError:
                msg = _("Invalid value %s for --reserve-mb") % opts.reserveMB
                if lineno != None:
                    raise KickstartParseError(formatErrorMsg(lineno, msg=msg))
                else:
                    raise KickstartParseError(msg)

        # Store the parsed arguments
        self.enabled = opts.enabled
        self.reserveMB =opts.reserveMB
Ejemplo n.º 35
0
 def _getParser(self):
     op = KSOptionParser(self.version)
     op.add_option("--erroronfail", dest="errorOnFail", action="store_true",
                   default=False)
     op.add_option("--interpreter", dest="interpreter", default="/bin/sh")
     op.add_option("--log", "--logfile", dest="log")
     return op
Ejemplo n.º 36
0
 def _getParser(self):
     op = KSOptionParser(self.version)
     op.add_option("--erroronfail", dest="errorOnFail", action="store_true",
                   default=False)
     op.add_option("--interpreter", dest="interpreter", default="/bin/sh")
     op.add_option("--log", "--logfile", dest="log")
     return op
Ejemplo n.º 37
0
 def _getParser(self):
     op = KSOptionParser()
     op.add_option("--host")
     op.add_option("--level", type="choice",
                   choices=["debug", "info", "warning", "error", "critical"])
     op.add_option("--port")
     return op
Ejemplo n.º 38
0
    def _getParser(self):
        op = KSOptionParser()

        op.add_option("--reformat", dest="reformat", default=False)
        op.add_option("--mkfsoptions", dest="mkfs_opts", action="store")
        op.add_option("--mountoptions", dest="mount_opts", action="store")

        return op
Ejemplo n.º 39
0
 def _getParser(self):
     op = KSOptionParser()
     op.add_option("--host")
     op.add_option(
         "--level",
         type="choice",
         choices=["debug", "info", "warning", "error", "critical"])
     op.add_option("--port")
     return op
Ejemplo n.º 40
0
    def handle_header(self, lineno, args):
        op = KSOptionParser()
        op.add_option("--enable",
                      action="store_true",
                      default=True,
                      dest="enabled",
                      help="Enable kdump")
        op.add_option("--enablefadump",
                      action="store_true",
                      default=False,
                      dest="enablefadump",
                      help="Enable dump mode fadump")
        op.add_option("--disable",
                      action="store_false",
                      dest="enabled",
                      help="Disable kdump")
        op.add_option("--reserve-mb",
                      type="string",
                      dest="reserveMB",
                      default="128",
                      help="Amount of memory in MB to reserve for kdump.")

        (opts, extra) = op.parse_args(args=args, lineno=lineno)

        # Reject any additional arguments
        if extra:
            AddonData.handle_header(self, lineno, extra)

        # Validate the reserve-mb argument
        # Allow a final 'M' for consistency with the crashkernel kernel
        # parameter. Strip it if found.
        if opts.reserveMB and opts.reserveMB[-1] == 'M':
            opts.reserveMB = opts.reserveMB[:-1]

        try:
            _test = int(opts.reserveMB)
        except ValueError:
            msg = _("Invalid value %s for --reserve-mb") % opts.reserveMB
            if lineno != None:
                raise KickstartParseError(formatErrorMsg(lineno, msg=msg))
            else:
                raise KickstartParseError(msg)

        # Store the parsed arguments
        self.enabled = opts.enabled
        self.reserveMB = opts.reserveMB
        self.enablefadump = opts.enablefadump
Ejemplo n.º 41
0
 def _getParser(self):
     op = KSOptionParser()
     op.add_option("--disabled", dest="selinux", action="store_const",
                   const=SELINUX_DISABLED)
     op.add_option("--enforcing", dest="selinux", action="store_const",
                   const=SELINUX_ENFORCING)
     op.add_option("--permissive", dest="selinux", action="store_const",
                   const=SELINUX_PERMISSIVE)
     return op
Ejemplo n.º 42
0
    def handle_header(self, lineno, args):

        op = KSOptionParser()
        op.add_option("--enable",
                      "-e",
                      action="store_true",
                      default=False,
                      dest="state",
                      help="Enable Cloud Support")
        op.add_option("--disable",
                      "-d",
                      action="store_false",
                      dest="state",
                      help="(Default) Disable Cloud Support")
        op.add_option("--allinone",
                      "-a",
                      action="store_true",
                      default=False,
                      dest="mode",
                      help="Specify the mode of Packstack Installation")
        op.add_option("--answer-file",
                      "-f",
                      action="store",
                      type="string",
                      dest="file",
                      help="Specify URL of answers file")
        (options, extra) = op.parse_args(args=args, lineno=lineno)

        # Error Handling
        if str(options.state) == "True":
            self.state = str(options.state)
            if options.file and options.mode:
                msg = "options --allinone and --answer-file are mutually exclusive"
                raise KickstartParseError(msg)
            elif options.file:
                try:
                    response = urllib2.urlopen(options.file)
                    for line in response:
                        self.lines += line
                except urllib2.HTTPError, e:
                    msg = "Kickstart Error:: HTTPError: " + str(e.code)
                    raise KickstartParseError, formatErrorMsg(lineno, msg=msg)
                except urllib2.URLError, e:
                    msg = "Kickstart Error: HTTPError: " + str(e.reason)
                    raise KickstartParseError, formatErrorMsg(lineno, msg=msg)
                except:
Ejemplo n.º 43
0
    def _getParser(self):
        # Have to be a little more complicated to set two values.
        def vg_cb(option, opt_str, value, parser):
            parser.values.format = False
            parser.values.preexist = True

        op = KSOptionParser()
        op.add_option("--noformat", action="callback", callback=vg_cb, dest="format", default=True, nargs=0)
        op.add_option("--pesize", dest="pesize", type="int", nargs=1, default=32768)
        op.add_option("--useexisting", dest="preexist", action="store_true", default=False)
        return op
Ejemplo n.º 44
0
 def _getParser(self):
     op = KSOptionParser()
     op.add_option("--disabled",
                   dest="selinux",
                   action="store_const",
                   const=SELINUX_DISABLED)
     op.add_option("--enforcing",
                   dest="selinux",
                   action="store_const",
                   const=SELINUX_ENFORCING)
     op.add_option("--permissive",
                   dest="selinux",
                   action="store_const",
                   const=SELINUX_PERMISSIVE)
     return op
Ejemplo n.º 45
0
 def _getParser(self):
     op = KSOptionParser()
     op.add_option("--disable",
                   "--disabled",
                   dest="firstboot",
                   action="store_const",
                   const=FIRSTBOOT_SKIP)
     op.add_option("--enable",
                   "--enabled",
                   dest="firstboot",
                   action="store_const",
                   const=FIRSTBOOT_DEFAULT)
     op.add_option("--reconfig",
                   dest="firstboot",
                   action="store_const",
                   const=FIRSTBOOT_RECONFIG)
     return op
Ejemplo n.º 46
0
    def _getParser(self):
        # Have to be a little more complicated to set two values.
        def vg_cb(option, opt_str, value, parser):
            parser.values.format = False
            parser.values.preexist = True

        op = KSOptionParser()
        op.add_option("--noformat",
                      action="callback",
                      callback=vg_cb,
                      dest="format",
                      default=True,
                      nargs=0)
        op.add_option("--pesize",
                      dest="pesize",
                      type="int",
                      nargs=1,
                      default=32768)
        op.add_option("--useexisting",
                      dest="preexist",
                      action="store_true",
                      default=False)
        return op
Ejemplo n.º 47
0
 def _getParser(self):
     op = KSOptionParser()
     op.add_option("--add-boot", action="store_true", dest="addBoot", default=False)
     return op
Ejemplo n.º 48
0
    def handleHeader(self, lineno, args):
        """Process the arguments to the %packages header and set attributes
           on the Version's Packages instance appropriate.  This method may be
           overridden in a subclass if necessary.
        """
        Section.handleHeader(self, lineno, args)
        op = KSOptionParser(version=self.version)
        op.add_option("--excludedocs", dest="excludedocs", action="store_true",
                      default=False)
        op.add_option("--ignoremissing", dest="ignoremissing",
                      action="store_true", default=False)
        op.add_option("--nobase", dest="nobase", action="store_true",
                      default=False, deprecated=F18)
        op.add_option("--nocore", dest="nocore", action="store_true",
                      default=False, introduced=F21)
        op.add_option("--ignoredeps", dest="resolveDeps", action="store_false",
                      deprecated=FC4, removed=F9)
        op.add_option("--resolvedeps", dest="resolveDeps", action="store_true",
                      deprecated=FC4, removed=F9)
        op.add_option("--default", dest="defaultPackages", action="store_true",
                      default=False, introduced=F7)
        op.add_option("--instLangs", dest="instLangs", type="string",
                      default="", introduced=F9)
        op.add_option("--multilib", dest="multiLib", action="store_true",
                      default=False, introduced=F18)
        op.add_option("--timeout", dest="timeout", type="int",
                      default=None, introduced=RHEL7)
        op.add_option("--retries", dest="retries", type="int",
                      default=None, introduced=RHEL7)

        (opts, _extra) = op.parse_args(args=args[1:], lineno=lineno)

        if opts.defaultPackages and opts.nobase:
            raise KickstartParseError(formatErrorMsg(lineno, msg=_("--default and --nobase cannot be used together")))
        elif opts.defaultPackages and opts.nocore:
            raise KickstartParseError(formatErrorMsg(lineno, msg=_("--default and --nocore cannot be used together")))

        self.handler.packages.excludeDocs = opts.excludedocs
        self.handler.packages.addBase = not opts.nobase
        if opts.ignoremissing:
            self.handler.packages.handleMissing = KS_MISSING_IGNORE
        else:
            self.handler.packages.handleMissing = KS_MISSING_PROMPT

        if opts.defaultPackages:
            self.handler.packages.default = True

        if opts.instLangs:
            self.handler.packages.instLangs = opts.instLangs

        self.handler.packages.nocore = opts.nocore
        self.handler.packages.multiLib = opts.multiLib
        self.handler.packages.timeout = opts.timeout
        self.handler.packages.retries = opts.retries
        self.handler.packages.seen = True
Ejemplo n.º 49
0
    def handleHeader(self, lineno, args):
        """Process the arguments to the %packages header and set attributes
           on the Version's Packages instance appropriate.  This method may be
           overridden in a subclass if necessary.
        """
        Section.handleHeader(self, lineno, args)
        op = KSOptionParser(version=self.version)
        op.add_option("--excludedocs", dest="excludedocs", action="store_true",
                      default=False)
        op.add_option("--ignoremissing", dest="ignoremissing",
                      action="store_true", default=False)
        op.add_option("--nobase", dest="nobase", action="store_true",
                      default=False, deprecated=F18, removed=F22)
        op.add_option("--nocore", dest="nocore", action="store_true",
                      default=False, introduced=F21)
        op.add_option("--ignoredeps", dest="resolveDeps", action="store_false",
                      deprecated=FC4, removed=F9)
        op.add_option("--resolvedeps", dest="resolveDeps", action="store_true",
                      deprecated=FC4, removed=F9)
        op.add_option("--default", dest="defaultPackages", action="store_true",
                      default=False, introduced=F7)
        op.add_option("--instLangs", dest="instLangs", type="string",
                      default=None, introduced=F9)
        op.add_option("--multilib", dest="multiLib", action="store_true",
                      default=False, introduced=F18)

        (opts, _extra) = op.parse_args(args=args[1:], lineno=lineno)

        if opts.defaultPackages and opts.nobase:
            raise KickstartParseError(formatErrorMsg(lineno, msg=_("--default and --nobase cannot be used together")))
        elif opts.defaultPackages and opts.nocore:
            raise KickstartParseError(formatErrorMsg(lineno, msg=_("--default and --nocore cannot be used together")))

        self.handler.packages.excludeDocs = opts.excludedocs
        self.handler.packages.addBase = not opts.nobase
        if opts.ignoremissing:
            self.handler.packages.handleMissing = KS_MISSING_IGNORE
        else:
            self.handler.packages.handleMissing = KS_MISSING_PROMPT

        if opts.defaultPackages:
            self.handler.packages.default = True

        if opts.instLangs is not None:
            self.handler.packages.instLangs = opts.instLangs

        self.handler.packages.nocore = opts.nocore
        self.handler.packages.multiLib = opts.multiLib
        self.handler.packages.seen = True
Ejemplo n.º 50
0
    def _getParser(self):
        def driveorder_cb (option, opt_str, value, parser):
            for d in value.split(','):
                parser.values.ensure_value(option.dest, []).append(d)

        op = KSOptionParser()
        op.add_option("--append", dest="appendLine")
        op.add_option("--linear", dest="linear", action="store_true",
                      default=True)
        op.add_option("--nolinear", dest="linear", action="store_false")
        op.add_option("--location", dest="location", type="choice",
                      default="mbr",
                      choices=["mbr", "partition", "none", "boot"])
        op.add_option("--lba32", dest="forceLBA", action="store_true",
                      default=False)
        op.add_option("--password", dest="password", default="")
        op.add_option("--md5pass", dest="md5pass", default="")
        op.add_option("--upgrade", dest="upgrade", action="store_true",
                      default=False)
        op.add_option("--useLilo", dest="useLilo", action="store_true",
                      default=False)
        op.add_option("--driveorder", dest="driveorder", action="callback",
                      callback=driveorder_cb, nargs=1, type="string")
        return op
Ejemplo n.º 51
0
 def _getParser(self):
     op = KSOptionParser()
     op.add_option("--source")
     op.add_option("--type")
     return op
Ejemplo n.º 52
0
 def _getParser(self):
     op = KSOptionParser()
     op.add_option("--skip", action="store_true", default=False)
     return op
Ejemplo n.º 53
0
 def _getParser(self):
     op = KSOptionParser()
     op.add_option("--card")
     op.add_option("--defaultdesktop")
     op.add_option("--depth", action="store", type="int", nargs=1)
     op.add_option("--hsync")
     op.add_option("--monitor")
     op.add_option("--noprobe", dest="noProbe", action="store_true",
                   default=False)
     op.add_option("--resolution")
     op.add_option("--server")
     op.add_option("--startxonboot", dest="startX", action="store_true",
                   default=False)
     op.add_option("--videoram", dest="videoRam")
     op.add_option("--vsync")
     return op
Ejemplo n.º 54
0
    def _getParser(self):
        def lv_cb (option, opt_str, value, parser):
            parser.values.format = False
            parser.values.preexist = True

        op = KSOptionParser()
        op.add_option("--fstype", dest="fstype")
        op.add_option("--grow", dest="grow", action="store_true",
                      default=False)
        op.add_option("--maxsize", dest="maxSizeMB", action="store", type="int",
                      nargs=1)
        op.add_option("--name", dest="name", required=1)
        op.add_option("--noformat", action="callback", callback=lv_cb,
                      dest="format", default=True, nargs=0)
        op.add_option("--percent", dest="percent", action="store", type="int",
                      nargs=1)
        op.add_option("--recommended", dest="recommended", action="store_true",
                      default=False)
        op.add_option("--size", dest="size", action="store", type="int",
                      nargs=1)
        op.add_option("--useexisting", dest="preexist", action="store_true",
                      default=False)
        op.add_option("--vgname", dest="vgname", required=1)
        return op
Ejemplo n.º 55
0
 def _getParser(self):
     op = KSOptionParser()
     op.add_option("--bootproto",
                   dest="bootProto",
                   default=BOOTPROTO_DHCP,
                   choices=self.bootprotoList)
     op.add_option("--dhcpclass", dest="dhcpclass")
     op.add_option("--device", dest="device")
     op.add_option("--essid", dest="essid")
     op.add_option("--ethtool", dest="ethtool")
     op.add_option("--gateway", dest="gateway")
     op.add_option("--hostname", dest="hostname")
     op.add_option("--ip", dest="ip")
     op.add_option("--mtu", dest="mtu")
     op.add_option("--nameserver", dest="nameserver")
     op.add_option("--netmask", dest="netmask")
     op.add_option("--nodns",
                   dest="nodns",
                   action="store_true",
                   default=False)
     op.add_option("--onboot",
                   dest="onboot",
                   action="store",
                   type="ksboolean")
     op.add_option("--wepkey", dest="wepkey")
     return op
Ejemplo n.º 56
0
    def _getParser(self):
        def raid_cb (option, opt_str, value, parser):
            parser.values.format = False
            parser.values.preexist = True

        def device_cb (option, opt_str, value, parser):
            if value[0:2] == "md":
                parser.values.ensure_value(option.dest, value[2:])
            else:
                parser.values.ensure_value(option.dest, value)

        def level_cb (option, opt_str, value, parser):
            if value.upper() in self.levelMap:
                parser.values.ensure_value(option.dest, self.levelMap[value.upper()])

        op = KSOptionParser()
        op.add_option("--device", action="callback", callback=device_cb,
                      dest="device", type="string", nargs=1, required=1)
        op.add_option("--fstype", dest="fstype")
        op.add_option("--level", dest="level", action="callback",
                      callback=level_cb, type="string", nargs=1)
        op.add_option("--noformat", action="callback", callback=raid_cb,
                      dest="format", default=True, nargs=0)
        op.add_option("--spares", dest="spares", action="store", type="int",
                      nargs=1, default=0)
        op.add_option("--useexisting", dest="preexist", action="store_true",
                      default=False)
        return op
Ejemplo n.º 57
0
    def _getParser(self):
        # Have to be a little more complicated to set two values.
        def btrfs_cb(option, opt_str, value, parser):
            parser.values.format = False
            parser.values.preexist = True

        def level_cb(option, opt_str, value, parser):
            if value.lower() in self.levelMap:
                parser.values.ensure_value(option.dest,
                                           self.levelMap[value.lower()])

        op = KSOptionParser()
        op.add_option("--noformat",
                      action="callback",
                      callback=btrfs_cb,
                      dest="format",
                      default=True,
                      nargs=0)
        op.add_option("--useexisting",
                      action="callback",
                      callback=btrfs_cb,
                      dest="preexist",
                      default=False,
                      nargs=0)

        # label, data, metadata
        op.add_option("--label", dest="label", default="")
        op.add_option("--data",
                      dest="dataLevel",
                      action="callback",
                      callback=level_cb,
                      type="string",
                      nargs=1)
        op.add_option("--metadata",
                      dest="metaDataLevel",
                      action="callback",
                      callback=level_cb,
                      type="string",
                      nargs=1)

        #
        # subvolumes
        #
        op.add_option("--subvol",
                      dest="subvol",
                      action="store_true",
                      default=False)

        # parent must be a device spec (LABEL, UUID, &c)
        op.add_option("--parent", dest="parent", default="")
        op.add_option("--name", dest="name", default="")

        return op