[Yum-devel] Setting a custom plugin configuration path

Mihai Ibanescu misa+yum at redhat.com
Wed May 17 20:40:17 UTC 2006


Hello,

Looking at yum 2.6.1...

Even though I could change the directory for the plugin modules themselves,
the path to the plugin configuration directory seems to be hardcoded in
plugins.py:

    def _getpluginconf(self, modname):
        '''Parse the plugin specific configuration file and return a
        IncludingConfigParser instance representing it. Returns None if there
        was an error reading or parsing the configuration file.
        '''
        #XXX: should this use installroot?
        conffilename = os.path.join('/etc/yum/pluginconf.d', modname+'.conf')


I would suggest to create a configuration option for it. Attached patch.

Comments?

Misa
-------------- next part --------------
diff -r 135d1226a8f5 yum/yum/config.py
--- a/yum/yum/config.py	Wed May 17 16:08:55 2006 -0400
+++ b/yum/yum/config.py	Wed May 17 16:39:12 2006 -0400
@@ -501,6 +501,7 @@ class YumConf(EarlyConf):
     proxy_username = Option()
     proxy_password = Option()
     pluginpath = ListOption(['/usr/lib/yum-plugins'])
+    pluginconf = ListOption(['/etc/yum/pluginconf.d'])
     installonlypkgs = ListOption(['kernel', 'kernel-bigmem',
             'kernel-enterprise','kernel-smp', 'kernel-modules', 'kernel-debug',
             'kernel-unsupported', 'kernel-source', 'kernel-devel'])
diff -r 135d1226a8f5 yum/yum/plugins.py
--- a/yum/yum/plugins.py	Wed May 17 16:08:55 2006 -0400
+++ b/yum/yum/plugins.py	Wed May 17 16:39:12 2006 -0400
@@ -242,7 +242,17 @@ class YumPlugins:
         was an error reading or parsing the configuration file.
         '''
         #XXX: should this use installroot?
-        conffilename = os.path.join('/home/devel/misa/hg/playpen/yum/pluginconf.d', modname+'.conf')
+        for pluginconf_dir in self.base.conf.pluginconf:
+            conffilename = os.path.join(pluginconf_dir, modname + ".conf")
+            if os.access(conffilename, os.R_OK):
+                # Found configuration file
+                break
+            self.base.log(3, "Configuration file %s not found" % conffilename)
+        else: # for
+            # Configuration files for the plugin not found
+            self.base.log(2, "Unable to find configuration file for plugin %s"
+                % modname)
+            return None
 
         try:
             parser = config.IncludingConfigParser()


More information about the Yum-devel mailing list