From 86a3298d8b69fe6b1e8258b825af389e004ff9ff Mon Sep 17 00:00:00 2001 From: "Chris St. Pierre" Date: Wed, 15 Aug 2012 09:44:05 -0400 Subject: better error messages from failed import in models.py --- src/lib/Bcfg2/Server/models.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src/lib/Bcfg2/Server') diff --git a/src/lib/Bcfg2/Server/models.py b/src/lib/Bcfg2/Server/models.py index 96a7261fd..2f7a1b8a0 100644 --- a/src/lib/Bcfg2/Server/models.py +++ b/src/lib/Bcfg2/Server/models.py @@ -40,14 +40,16 @@ def load_models(plugins=None, cfile='/etc/bcfg2.conf', quiet=True): plugin).Server.Plugins, plugin) except ImportError: try: + err = sys.exc_info()[1] mod = __import__(plugin) except: if plugins != Bcfg2.Server.Plugins.__all__: # only produce errors if the default plugin list # was not used -- i.e., if the config file was set # up. don't produce errors when trying to load - # all plugins, IOW - err = sys.exc_info()[1] + # all plugins, IOW. the error from the first + # attempt to import is probably more accurate than + # the second attempt. logger.error("Failed to load plugin %s: %s" % (plugin, err)) continue for sym in dir(mod): -- cgit v1.2.3-1-g7c22