Re: [PATCH] pykickstart: Add fcoe command

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

 



>  pykickstart/commands/fcoe.py    |   69 +++++++++++++++++++++++++++++++++++++++
>  pykickstart/handlers/control.py |    1 +
>  2 files changed, 70 insertions(+), 0 deletions(-)
>  create mode 100644 pykickstart/commands/fcoe.py

You also need to add an import in pykickstart/commands/__init__.py.

> +class F12_Fcoe(KickstartCommand):
> +    removedKeywords = KickstartCommand.removedKeywords
> +    removedAttrs = KickstartCommand.removedAttrs
> +
> +    def __init__(self, writePriority=0, *args, **kwargs):
> +        KickstartCommand.__init__(self, writePriority, *args, **kwargs)
> +        self.op = self._getParser()
> +        self.fcoe = kwargs.get("fcoe", [])

When writing out a kickstart file, does the "fcoe" command need to come
before or after any in particular, or can it just get wrtten out
wherever?  If you have requirements on where it gets written out, you'll
need to adjust the writePriority.  I should probably make a quick tool
to print out what command has what priority to aid in this.

> +    def parse(self, args):
> +        zd = self.handler.FcoeData()
> +        (opts, extra) = self.op.parse_args(args=args, lineno=self.lineno)
> +        self._setToObj(self.op, opts, zd)
> +        return zd

Depending on how picky you want to be, you should check that extra
options were not provided.  I like to do something like this just after
calling self.op.parse_args:

        if len(extra) > 0:
            mapping = {"command": "repo", "options": extra}
            raise KickstartValueError, formatErrorMsg(self.lineno, msg=_("Unexpected arguments to %( command)s command: %(options)s") % mapping)

> diff --git a/pykickstart/handlers/control.py b/pykickstart/handlers/control.py
> index 8e1ab66..be6d6f3 100644
> --- a/pykickstart/handlers/control.py
> +++ b/pykickstart/handlers/control.py
> @@ -541,6 +541,7 @@ commandMap = {
>          "deviceprobe": deviceprobe.FC3_DeviceProbe,
>          "dmraid": dmraid.FC6_DmRaid,
>          "driverdisk": driverdisk.FC3_DriverDisk,
> +        "fcoe": fcoe.F12_Fcoe,
>          "firewall": firewall.F10_Firewall,
>          "firstboot": firstboot.FC3_Firstboot,
>          "graphical": displaymode.FC3_DisplayMode,

You need to add a similar line to the correct version in the dataMap,
too.  Otherwise, that self.handler.FcoeData() call in the previous chunk
is going to fail.

- 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