summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris St. Pierre <chris.a.st.pierre@gmail.com>2012-08-15 09:44:05 -0400
committerChris St. Pierre <chris.a.st.pierre@gmail.com>2012-08-15 09:44:05 -0400
commit86a3298d8b69fe6b1e8258b825af389e004ff9ff (patch)
tree0747e234a4c6aa0ddd7041b136c344d073f2e206
parentb862090945322d5ba4b42e180bba92afb860df21 (diff)
downloadbcfg2-86a3298d8b69fe6b1e8258b825af389e004ff9ff.tar.gz
bcfg2-86a3298d8b69fe6b1e8258b825af389e004ff9ff.tar.bz2
bcfg2-86a3298d8b69fe6b1e8258b825af389e004ff9ff.zip
better error messages from failed import in models.py
-rw-r--r--src/lib/Bcfg2/Server/models.py6
1 files changed, 4 insertions, 2 deletions
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):