listing available groups in yum with ids (for kickstart)

By thomas, 29 July, 2010
To list the package groups available in yum, you would use yum grouplist. When you are adding groups to your kickstart file, you use the id of the group not the name, so this *very* simple script lists the groups with their ids.
#!/usr/bin/python import yum yb = yum.YumBase() yb.doConfigSetup() yb.doTsSetup() for grp in yb.comps.groups: print "%s (%s)" % (grp.name,grp.groupid)
This is posted in my howto also