diff options
author | Tim Laszlo <tim.laszlo@gmail.com> | 2012-08-15 15:27:21 -0500 |
---|---|---|
committer | Tim Laszlo <tim.laszlo@gmail.com> | 2012-08-15 15:27:41 -0500 |
commit | 58a697300d2863c5c2994b90b8a4f27a7db987fa (patch) | |
tree | 121862d7c985ed82c156a843353767a122b2d69d /src | |
parent | 3b6b3a3f8fbaf727cc3aaf84cd03c038eab3461a (diff) | |
download | bcfg2-58a697300d2863c5c2994b90b8a4f27a7db987fa.tar.gz bcfg2-58a697300d2863c5c2994b90b8a4f27a7db987fa.tar.bz2 bcfg2-58a697300d2863c5c2994b90b8a4f27a7db987fa.zip |
Core: Catch attribute errors. Allow loading submodules
Diffstat (limited to 'src')
-rw-r--r-- | src/lib/Bcfg2/Server/Core.py | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/lib/Bcfg2/Server/Core.py b/src/lib/Bcfg2/Server/Core.py index 4465abb9a..49b5628a1 100644 --- a/src/lib/Bcfg2/Server/Core.py +++ b/src/lib/Bcfg2/Server/Core.py @@ -209,11 +209,15 @@ class BaseCore(object): (plugin)).Server.Plugins, plugin) except ImportError: try: - mod = __import__(plugin) + mod = __import__(plugin, globals(), locals(), [plugin.split('.')[-1]]) except: self.logger.error("Failed to load plugin %s" % plugin) return - plug = getattr(mod, plugin) + try: + plug = getattr(mod, plugin.split('.')[-1]) + except AttributeError: + self.logger.error("Failed to load plugin %s (AttributeError)" % plugin) + return # Blacklist conflicting plugins cplugs = [conflict for conflict in plug.conflicts if conflict in self.plugins] |