[yum-commits] yum/plugins.py

James Antill james at osuosl.org
Wed Sep 25 20:56:51 UTC 2013


 yum/plugins.py |   19 ++++++++++---------
 1 file changed, 10 insertions(+), 9 deletions(-)

New commits:
commit 67ad52cef6acb6d214f6f76100d2f3fb11886652
Author: James Antill <james at and.org>
Date:   Wed Sep 25 01:30:07 2013 -0400

     Move disableplugin checks to before we load the conf/module, mostly for speed.
    
     Eg. if a plugin does "while True: pass" at the top level, we wil
    currently run that code even if the plugin is disabled (disabled just
    means we never run it's hooks).
     Note that .conf disabled has always disabled loading too.

diff --git a/yum/plugins.py b/yum/plugins.py
index a10e4fb..f34ea19 100644
--- a/yum/plugins.py
+++ b/yum/plugins.py
@@ -254,6 +254,16 @@ class YumPlugins:
         dir, modname = os.path.split(modulefile)
         modname = modname.split('.py')[0]
 
+        #  This should really work like enable/disable repo. and be based on the
+        # cmd line order ... but the API doesn't really allow that easily.
+        # FIXME: Fix for 4.* (lol)
+        # Do disabled cmd line checks before loading the module code.
+        if (self._plugin_cmdline_match(modname, self.disabledPlugins,
+                                       self._used_disable_plugin) and
+            not self._plugin_cmdline_match(modname, self.enabledPlugins,
+                                           self._used_enable_plugin)):
+            return
+
         conf = self._getpluginconf(modname)
         if (not conf or
             (not config.getOption(conf, 'main', 'enabled',
@@ -308,15 +318,6 @@ class YumPlugins:
             if plugintype not in types:
                 return
 
-        #  This should really work like enable/disable repo. and be based on the
-        # cmd line order ... but the API doesn't really allow that easily.
-        # FIXME: Fix for 4.*
-        if (self._plugin_cmdline_match(modname, self.disabledPlugins,
-                                       self._used_disable_plugin) and
-            not self._plugin_cmdline_match(modname, self.enabledPlugins,
-                                           self._used_enable_plugin)):
-            return
-
         self.verbose_logger.log(logginglevels.DEBUG_3, _('Loading "%s" plugin'),
                                 modname)
 


More information about the Yum-commits mailing list