Re: kickstart vs. yum

Bryan Smith <[email protected]>
Newsgroups gmane.linux.redhat.kickstart.general
Message-ID <53e7b170-8a63-414a-88eb-0211fa79f116@zmail07.collab.prod.int.phx2.redhat.com>
Understood.  I was referring more to piping the information out as you desire, hence the "P.S." (and not really part of my response).  But thank you for pointing out one should script around repoquery instead of yum, and that was an oversight on my part.

I also noted the comps.xml file in my "P.S.," which I've written Perl around in the past.  I've also done some custom Anaconda Python modification, but that was years ago (FC6/RHEL5 timeframe, long story, you might remember some of it).  I guess I was referring more to modifying the comps.xml file directly, to add new groups.  Is there a better method via the Python API to do such?  Or is it okay (or even best) to do it off-line, on the comps.xml file directly?


----- Original Message -----
From: "seth vidal" <[email protected]>
Sent: Saturday, February 11, 2012 12:31:08 PM

Hi Bryan,
 yum's cli is not intended to be scripted. Don't recommend that to
others.

If you want to script to yum you should use either of the following:
 - repoquery
 - yum's python api
 
The yum python interface for working with the comps file is actually
pretty straightforward
 as an example

#!/usr/bin/python
import yum
my = yum.YumBase()
my.setCacheDir()
for g in my.comps.groups:
    print g.groupid

core = my.comps.return_group('core')
for pkg in core.packages:
    print pkg

lots to explore in there - I recommend using ipython to help you
explore the interface.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.