Esempio n. 1
0
	def handle_header(self, lineno, args):

		op = KSOptionParser()
		op.add_option("--homer-user", action="store_true", default=False,
		dest="homer_user", help="Homer database user name")
		op.add_option("--homer-password", action="store_true", default=False,
		dest="homer_password", help="Homer database user password")
		op.add_option("--homer-database-name", action="store_true", default=False,
		dest="homer_database_name", help="Homer database name")
		op.add_option("--homer-database-host", action="store_true", default=False,
		dest="homer_database_host", help="Homer database host")
		op.add_option("--homer-timezone", action="store_true", default=False,
		dest="homer_timezone", help="Homer database timezone")
		op.add_option("--web-server-type", action="store_true", default=False,
		dest="homer_webserver_type", help="Homer web-server type: httpd or nginx")


		(opts, extra) = op.parse_args(args=args, lineno=lineno)
#
#		# Reject any additoinal 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, extra)
		# Store the result of the option parsing
		self.homer_user = opts.homer_user
		self.homer_password = opts.homer_password
		self.homer_database_name = opts.homer_database_name
		self.homer_database_host = opts.homer_database_host
		self.homer_timezone = opts.homer_timezone
		self.homer_webserver_type = opts.homer_webserver_type
    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
Esempio n. 3
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
Esempio n. 4
0
    def handle_header(self, lineno, args):
        op = KSOptionParser(prog="addon com_redhat_kdump",
                            version=F27,
                            description="Configure the Kdump Addon.")
        op.add_argument("--enable",
                        action="store_true",
                        default=True,
                        version=F27,
                        dest="enabled",
                        help="Enable kdump")
        op.add_argument("--enablefadump",
                        action="store_true",
                        default=False,
                        version=F27,
                        dest="enablefadump",
                        help="Enable dump mode fadump")
        op.add_argument("--disable",
                        action="store_false",
                        version=F27,
                        dest="enabled",
                        help="Disable kdump")
        op.add_argument("--reserve-mb",
                        type=str,
                        dest="reserveMB",
                        version=F27,
                        default="128",
                        help="Amount of memory in MB to reserve for kdump.")

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

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

        # Validate the reserve-mb argument
        opts.reserveMB = opts.reserveMB.strip("'\"")
        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
        self.enablefadump = opts.enablefadump
Esempio n. 5
0
    def handle_header(self, lineno, args):

        op = KSOptionParser()
        op.add_option("--homer-user",
                      action="store_true",
                      default=False,
                      dest="homer_user",
                      help="Homer database user name")
        op.add_option("--homer-password",
                      action="store_true",
                      default=False,
                      dest="homer_password",
                      help="Homer database user password")
        op.add_option("--homer-database-name",
                      action="store_true",
                      default=False,
                      dest="homer_database_name",
                      help="Homer database name")
        op.add_option("--homer-database-host",
                      action="store_true",
                      default=False,
                      dest="homer_database_host",
                      help="Homer database host")
        op.add_option("--homer-timezone",
                      action="store_true",
                      default=False,
                      dest="homer_timezone",
                      help="Homer database timezone")
        op.add_option("--web-server-type",
                      action="store_true",
                      default=False,
                      dest="homer_webserver_type",
                      help="Homer web-server type: httpd or nginx")

        (opts, extra) = op.parse_args(args=args, lineno=lineno)
        #
        #		# Reject any additoinal 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, extra)
        # Store the result of the option parsing
        self.homer_user = opts.homer_user
        self.homer_password = opts.homer_password
        self.homer_database_name = opts.homer_database_name
        self.homer_database_host = opts.homer_database_host
        self.homer_timezone = opts.homer_timezone
        self.homer_webserver_type = opts.homer_webserver_type
Esempio n. 6
0
    def handle_header(self, lineno, args):
        op = KSOptionParser(prog="addon com_redhat_kdump", version=F27,
                            description="Configure the Kdump Addon.")
        op.add_argument("--enable", action="store_true", default=True,
                version=F27, dest="enabled", help="Enable kdump")
        op.add_argument("--enablefadump", action="store_true", default=False,
                version=F27, dest="enablefadump", help="Enable dump mode fadump")
        op.add_argument("--disable", action="store_false",
                version=F27, dest="enabled", help="Disable kdump")
        op.add_argument("--reserve-mb", type=str, dest="reserveMB",
                version=F27, default="128", help="Amount of memory in MB to reserve for kdump.")

        (opts, extra) = op.parse_known_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. And strip quotes.
        opts.reserveMB = opts.reserveMB.strip("'\"")
        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