Re: Machine readable list of kickstart options

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

 



> I wondered if Anaconda team could provide and support equivalent of
> 
> http://fedoraproject.org/wiki/Anaconda/Kickstart#Chapter_2._Kickstart_Options
> But in some computer readable format. Ideally in XML file.
> 
> Is is possible?

There's no XML format, but it should be fairly easy to use pykickstart
to get this information.  In fact, I've already got code to do this.
The attached script will print out a list of all the supported kickstart
commands and their options for whatever version you want.  It'll also
tell you whether the option is deprecated or not.  It appears to be
confused by commands that have aliases, so part and partition get the
same big long list of stuff.

- Chris
#!/usr/bin/python

from pykickstart.base import DeprecatedCommand
from pykickstart.version import *

import optparse
import os
import sys

from rhpl.translate import _
import rhpl.translate as translate

translate.textdomain("pykickstart")

def optsort(a, b):
    return a.get_opt_string() == b.get_opt_string()

op = optparse.OptionParser(usage="usage: %prog [options]")
op.add_option("-v", "--version", dest="version", default=DEVEL,
              help=_("version of kickstart syntax to report on"))

(opts, extra) = op.parse_args(sys.argv[1:])

if len(extra) > 0:
    print _("No extra arguments expected.")
    os._exit(1)

try:
    handler = makeVersion(opts.version)
except KickstartVersionError:
    print _("The version %s is not supported by pykickstart" % opts.version)
    cleanup(destdir)

keys = handler.commands.keys()
keys.sort()

for str in keys:
    cmd = handler.commands[str]

    if isinstance(cmd, DeprecatedCommand):
        print "%s (Deprecated)" % str
    else:
        print "%s" % str

    if hasattr(cmd, "op"):
        lst = cmd.op.option_list
        lst.sort(optsort)

        for op in lst:
            if op.removed and op.removed <= version or op.introduced and op.introduced < version:
                continue

            if op.deprecated:
                print "\t%s (Deprecated)" % op.get_opt_string()
            else:
                print "\t%s" % op.get_opt_string()
_______________________________________________
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