[yum-commits] Branch 'yum-3_2_X' - yum/plugins.py
James Antill
james at osuosl.org
Wed Oct 1 15:36:37 UTC 2008
yum/plugins.py | 25 +++++++++++++++++--------
1 file changed, 17 insertions(+), 8 deletions(-)
New commits:
commit e413e5e0110d0c604915de3b74a6bfd75747acc4
Author: James Antill <james at and.org>
Date: Wed Oct 1 11:36:14 2008 -0400
Do a simple try/except on the plugin load_module, dtops 464920 going critical
diff --git a/yum/plugins.py b/yum/plugins.py
index a623e16..82efdee 100644
--- a/yum/plugins.py
+++ b/yum/plugins.py
@@ -249,24 +249,33 @@ class YumPlugins:
self.verbose_logger.debug(_('"%s" plugin is disabled'), modname)
return
- fp, pathname, description = imp.find_module(modname, [dir])
try:
- module = imp.load_module(modname, fp, pathname, description)
- finally:
- fp.close()
+ fp, pathname, description = imp.find_module(modname, [dir])
+ try:
+ module = imp.load_module(modname, fp, pathname, description)
+ finally:
+ fp.close()
+ except:
+ if self.verbose_logger.isEnabledFor(logginglevels.DEBUG_4):
+ raise # Give full backtrace:
+ self.verbose_logger.error(_('Plugin "%s" can\'t be imported') %
+ modname)
+ return
# Check API version required by the plugin
if not hasattr(module, 'requires_api_version'):
- raise Errors.ConfigError(
- _('Plugin "%s" doesn\'t specify required API version') % modname
- )
+ self.verbose_logger.error(
+ _('Plugin "%s" doesn\'t specify required API version') %
+ modname)
+ return
if not apiverok(API_VERSION, module.requires_api_version):
- raise Errors.ConfigError(
+ self.verbose_logger.error(
_('Plugin "%s" requires API %s. Supported API is %s.') % (
modname,
module.requires_api_version,
API_VERSION,
))
+ return
# Check plugin type against filter
plugintypes = getattr(module, 'plugin_type', ALL_TYPES)
More information about the Yum-commits
mailing list