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. 

My plugin becomes:

def yumvar_hook(conduit):
    conf.yumvar["dellsysidpluginver"] = version
    try:
        sysid = getSystemId()
        conf.yumvar["sys_ven_id"] = "0x1028"  # hex
        conf.yumvar["sys_dev_id"] = "0x%04x" % sysid
    except:
        pass

def init_hook(conduit):
    if YUM_API_VERSION >= yumvars-hook-api-version:
        return

    # do a bunch of backwards compat stuff

--
Michael
_______________________________________________
Yum-devel mailing list
[email protected]
https://lists.dulug.duke.edu/mailman/listinfo/yum-devel

Reply via email to