Ok, so it has been almost a week since I've posted about this, and I
have not gotten any more helpful responses. I really need some help on
this. The entirety of my yum plugin code is inline at the end of this
message.

    My situation: my dellsysidplugin.py yum plugin code appears to
function perfectly well. I have had two reports, though, that it
conflicts with other plugins. The yum presto folks say that I am
initializing the repos too early, and I have a report that PUP will
crash in a very undignified manner when network connectivity is not
present due to my plugin initializing the repos at a spot where they are
not expecting to catch that sort of exception.

    I need help, as I dont understand all of the yum internals. My
plugin is all of 60 lines long, and I can't see that I am doing anything
incorrectly. I am using the methods given to me by the conduit and I am
not abusing anything, as far as I can tell.

    My one and only desire is to insert a new value in 'yumvars' before
it is used by any other code, eg. the URL processing code (so it can be
used in mirrorlist= and baseurl= substitutions). At the moment, there is
not a plugin hook that is called early enough, so pretty much everything
including and after "repos = conduit.getRepos()" is to work around this.
Yes, my plugin could be reduced to about 6 lines with the appropriate
hooks.

    I really would like to resolve this, as I find it unpleasant to get
bug reports that say my code is breaking other people's stuff. I would
like to see this resolved before F7 release, if possible.

    My best suggestion so far has been a new plugin hook that reuses the
init conduit, called 'yumvars', which is called immediately after
yumvars is set up. Seth had a quick suggestion about re-using config
plugin last week that didnt seem workable to me.

    Any help would be appreciated.

Thanks,
Michael Brown

=======================================================================
import os
import sys

from biosHdr import getSystemId

from yum.plugins import TYPE_CORE

version="1.2.12.2_BETA"

requires_api_version = '2.1'
plugin_type = TYPE_CORE

def init_hook(conduit):
    """ 
    Plugin initialization hook. Sets up system id variables.

    Note: this should be compatible with any other vendor plugin that sets
    these variables because we only ever set them on Dell systems.
    """

    conf = conduit.getConf()

    sysid=0
    try:
        sysid = getSystemId()
    except:
        pass

    conf.yumvar["dellsysidpluginver"] = version

    if sysid:
        conf.yumvar["sys_ven_id"] = "0x1028"  # hex
        conf.yumvar["sys_dev_id"] = "0x%04x" % sysid

    repos = conduit.getRepos()
    for repo in repos.findRepos('*'):
        repo.yumvar.update(conf.yumvar)

    # re-process mirrorlist (it isnt varReplaced like baseUrl is)
    for repo in repos.findRepos('*'):
        try:
            # yum 3.0+
            if repo.mirrorlist:
                for (key, value) in conf.yumvar.items():
                    repo.mirrorlist = repo.mirrorlist.replace("$%s" % key, 
value)
        except AttributeError:
            pass

        try:
            # yum 2.4.3
            if repo.mirrorlistfn:
                for (key, value) in conf.yumvar.items():
                    repo.mirrorlistfn = repo.mirrorlistfn.replace("$%s" % key, 
value)
        except AttributeError:
            pass
_______________________________________________
Yum-devel mailing list
[email protected]
https://lists.dulug.duke.edu/mailman/listinfo/yum-devel

Reply via email to