def parse_kickstart_packages(path):
    """Return content of packages sections in the kickstart file."""
    handler = pykickstart.version.makeVersion()
    parser = MaskableKickstartParser(handler)

    # Ignore all commands and sections except the packages.
    handler.maskAllExcept({})
    parser.mask_all({pykickstart.sections.PackageSection.sectionOpen})

    parser.readKickstart(path)

    return handler.packages
示例#2
0
def parse_kickstart_packages(path):
    """Return content of packages sections in the kickstart file."""
    handler = pykickstart.version.makeVersion()
    parser = MaskableKickstartParser(handler)

    # Ignore all commands and sections except the packages.
    handler.maskAllExcept({})
    parser.mask_all({pykickstart.sections.PackageSection.sectionOpen})

    parser.readKickstart(path)

    return handler.packages
    if version:
        version_cls = pykickstart.version.stringToVersion(version)
    else:
        version_cls = pykickstart.version.makeVersion()

    comps = ElementTree.parse(comps_filename)

    # pykickstart is going to look for files relative to
    # the current directory of the kickstart file
    working_directory = os.path.dirname(kickstart_filename)
    if working_directory:
        os.chdir(working_directory)

    parser = pykickstart.parser.KickstartParser(version_cls)
    parser.readKickstart(kickstart_filename)

    comps_groups = comps.findall("group")
    packages_for_group = {}
    for group in comps_groups:
        group_id = group.find("id")
        assert group_id is not None
        pkglist_node = group.find("packagelist")
        assert pkglist_node is not None
        reqs = pkglist_node.findall("packagereq")
        pkglist = []
        for req in reqs:
            if req.attrib["type"] in ("default", "mandatory"):
                pkglist.append(req.text)
        packages_for_group[group_id.text] = pkglist
示例#4
0
    if version:
        version_cls = pykickstart.version.stringToVersion(version)
    else:
        version_cls = pykickstart.version.makeVersion()

    comps = ElementTree.parse(comps_filename)

    # pykickstart is going to look for files relative to
    # the current directory of the kickstart file
    working_directory = os.path.dirname(kickstart_filename)
    if working_directory:
        os.chdir(working_directory)

    parser = pykickstart.parser.KickstartParser(version_cls)
    parser.readKickstart(kickstart_filename)

    comps_groups = comps.findall('group')
    packages_for_group = {}
    for group in comps_groups:
        group_id = group.find('id')
        assert group_id is not None
        pkglist_node = group.find('packagelist')
        assert pkglist_node is not None
        reqs = pkglist_node.findall('packagereq')
        pkglist = []
        for req in reqs:
            if req.attrib['type'] in ('default', 'mandatory'):
                pkglist.append(req.text)
        packages_for_group[group_id.text] = pkglist