Re: [pykickstart] [PATCH v2] Add --nontp option and a way to specify NTP servers to the timezone command

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



>  pykickstart/commands/timezone.py |   49 ++++++++++++++++++++++++++++++++++++++
>  pykickstart/handlers/control.py  |    2 +-
>  2 files changed, 50 insertions(+), 1 deletions(-)

Whenever you modify a kickstart command, please also add a test case.

> +    def parse(self, args):
> +        (opts, extra) = self.op.parse_args(args=args, lineno=self.lineno)
> +        self._setToSelf(self.op, opts)
> +
> +        #we need to split args into timezone(s) and NTP servers
> +
> +        #examples: Europe/Prague, America/Argentina/Buenos_Aires
> +        timezone_re = re.compile(r"^[A-Z][ a-z]*/[A-Z][_/A-Za-z]*$")
> +
> +        #example: ntp.cesnet.cz
> +        ntpsrv_re = re.compile(r"^[-a-zA-Z0-9.]+$")
> +
> +        for arg in extra:
> +            if timezone_re.match(arg):
> +                #last timezone specified wins
> +                self.timezone = arg
> +
> +            elif ntpsrv_re.match(arg):
> +                self.ntp_servers.add(arg)
> +
> +        if not self.timezone:
> +            err_msg = _("Kickstart command 'timezone' requires valid timezone"\
> +                        " as an argument")
> +            raise KickstartValueError(formatErrorMsg(self.lineno, msg=err_msg))
> +
> +        return self

I really don't like this.  I can't think of another place in kickstart
where a command takes two arbitrary lists of arguments, and even if such
a place exists I still don't like it.  I would much prefer another
argument --ntpservers= be added that takes a comma separated list of
servers.

- Chris

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/anaconda-devel-list


[Index of Archives]     [Kickstart]     [Fedora Users]     [Fedora Legacy List]     [Fedora Maintainers]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]
  Powered by Linux