[Yum-devel] API question: reset all repos

tim.lauridsen at gmail.com tim.lauridsen at gmail.com
Thu Jan 12 12:04:10 UTC 2012


On Wed, Jan 11, 2012 at 6:42 PM, Jack Neely <jjneely at ncsu.edu> wrote:

> On Wed, Jan 11, 2012 at 09:28:20AM -0500, Zdenek Pavlas wrote:
> > > So, every time I get to the install packages method I'd like to make
> > > sure Yum knows about any repos that may have been potentially
> > > added...or taken away.
> >
> > Creating a new YumBase instance is the safest bet,
> > but you may also try the following.
> >
> > 'del b.repos' throw all repos away, and reinits
> > b._repos to an empty, uninitialized repo storage.
> >
> > 'b.prerepoconf' instructs the getter for self.repos
> > to run getReposFromConfig() and do some initialization.
> >
> > >>> import yum
> > >>> b = yum.YumBase()
>
> Yeah, this works like a champ.
>
> > >>> del b.repos
> > >>> b.prerepoconf = yum._YumPreRepoConf()
>
> However, this does not.  I get the familiar "No package(s) available to
> install" and "Problem in reinstall: no package foobar matched to
> install."  So something isn't getting reloaded here.
>
>
The best way to be sure is to make a new yum.YumBase()

del b.repos
b. getReposFromConfig()

get your part of the way, but if you have plugins adding repos, will not
get these repo the second time :)

I have tested with yum-3.2.29-17.el6_1.1.noarch, there can be changes in
new versions

Tim

I
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.baseurl.org/pipermail/yum-devel/attachments/20120112/44a3628d/attachment.html>


More information about the Yum-devel mailing list