[Yum-devel] request: yumvar plugin hook

seth vidal skvidal at linux.duke.edu
Tue Apr 17 03:04:27 UTC 2007


On Mon, 2007-04-16 at 12:07 -0500, Michael E Brown wrote:
> On Sat, Apr 07, 2007 at 04:57:28PM -0500, Michael E Brown wrote:
> > I would like to request a new yum plugin hook: yumvars_hook. Run
> > self.plugins.run('yumvars') right after 
> >     doConfigSetup(...):
> >         ...
> >         self.conf = config.readMainConfig(startupconf)
> >         self.plugins.run('yumvars')
> > 
> > I believe it should re-use the same conduit as the init_hook.
> > 
> > The reason for this is for future compatibility. Right now, I use an
> > init_hook, and I have to repo.yumvar.update() after I add a yumvar, as
> > well as manually reprocess the mirrorlist variable. If, in the future,
> > the mirrorlist is processed differently (as I just found out is the case
> > for at least yum 2.4.3, so it may be different in the future as well), I
> > wont have to do anything special.
> > 
> > I would be able to make a plugin that is compatible with a wide range of
> > yum versions by exiting early in the init_hook if the plugin api is new
> 
> https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=236478
> 
> This bugzilla defect would be fixed if I had the yumvar hook outlined
> above. 
> 

okay, I'm looking at this code and other spots and two things pop into
mind:

1. it seems like it might make more sense to have a pre_config_hook and
a post_config_hook so people could molest the config obj before and
after its setup - that would cover yumvars.

2. odd that we're not using the config slot anywhere at all, even though
it appears to be defined in plugins.py. it might be best to make these
lines in __init__.py:

        self.conf = config.readMainConfig(startupconf)
        self.yumvar = self.conf.yumvar
        self.getReposFromConfig()

into:

        self.conf = config.readMainConfig(startupconf)
        self.plugins.run('config')
        self.yumvar = self.conf.yumvar
        self.getReposFromConfig()

Then we cover the case needed and we're just using what we already have.

thoughts?
-sv





More information about the Yum-devel mailing list