[Yum-devel] Plugin interface to add yumvars?
Panu Matilainen
pmatilai at laiskiainen.org
Tue Mar 20 06:26:20 UTC 2007
On Mon, 19 Mar 2007, Michael E Brown wrote:
> On Mon, Mar 19, 2007 at 05:44:42PM -0400, seth vidal wrote:
>> On Mon, 2007-03-19 at 09:48 -0500, Michael E Brown wrote:
>>> I would like to write a plugin to be able to add vars to the 'yumvars' hash. I
>>> would like to have a yum repo like this:
>>>
>>> [dell-machinespecific]
>>> baseurl=http://linux.dell.com/repo/machine_specific/system-$dellsystemid
>>>
>>> But the problem I see is that there is no place where the plugins get called
>>> between where yumvars is set (readMainConfig()) and where it is used
>>> (getReposFromConfig()):
>>>
>>> --> yum/__init__.py doConfigSetup():
>>> ======================================
>>> self.conf = config.readMainConfig(startupconf)
>>> self.yumvar = self.conf.yumvar
>>> self.getReposFromConfig()
>>>
>>> The only way I can see to do this is really ugly. Any suggestions?
>>
>> Hmm, What you want to do might not be possible right now. But your
>> reason for wanting to do it is interesting. It might make for a good
>> reason to add the ability to do this. Can you use the
>> environment-variable defined values in the interim? YUMVAR0-9, I mean.
>
> Unless I grossly mistake the usage of these vars, no, I dont believe so. The
> problem is reliability. The user has to manually set these prior to running
> yum, and I dont think I can really rely on this. Plus it would have to be set
> for things like pup, etc.
You could set the environment from /etc/profile.d/ or something, but I
agree that's not very convenient.
> What I was thinking of was using an init_hook to go and grub through the
> configuration and manually replace the strings. It duplicates a lot of code,
> but looks do-able until an official hook exists. What do you think?
One possibility might be having the plugin itself set up that special
repository, instead of relying on yumvars and standard repo configuration.
Depends on what you need.. but since it's a system specific repo it's
highly special anyway.
Being able to create custom yumvar's from plugins (cleanly) would
certainly be nice regardless.
- Panu -
More information about the Yum-devel
mailing list