summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorChris St. Pierre <chris.a.st.pierre@gmail.com>2013-02-08 08:12:19 -0500
committerChris St. Pierre <chris.a.st.pierre@gmail.com>2013-02-08 08:12:19 -0500
commit55807333ccb7d80c4e2f074c2a1a10f554e57289 (patch)
tree8ef7235df6b6c2a6b2bf404dfe916427d9d95a96 /src
parent03b9d1774ad1c89eb51e7fc24f6b47267f9bb474 (diff)
downloadbcfg2-55807333ccb7d80c4e2f074c2a1a10f554e57289.tar.gz
bcfg2-55807333ccb7d80c4e2f074c2a1a10f554e57289.tar.bz2
bcfg2-55807333ccb7d80c4e2f074c2a1a10f554e57289.zip
Core: deduplicated some error handling code
Diffstat (limited to 'src')
-rw-r--r--src/lib/Bcfg2/Server/Core.py16
1 files changed, 7 insertions, 9 deletions
diff --git a/src/lib/Bcfg2/Server/Core.py b/src/lib/Bcfg2/Server/Core.py
index 81bfebbb5..782aafbf1 100644
--- a/src/lib/Bcfg2/Server/Core.py
+++ b/src/lib/Bcfg2/Server/Core.py
@@ -552,18 +552,16 @@ class BaseCore(object):
continue
try:
self.Bind(entry, metadata)
- except PluginExecutionError:
- exc = sys.exc_info()[1]
- if 'failure' not in entry.attrib:
- entry.set('failure', 'bind error: %s' % exc)
- self.logger.error("Failed to bind entry %s:%s: %s" %
- (entry.tag, entry.get('name'), exc))
- except Exception:
+ except:
exc = sys.exc_info()[1]
if 'failure' not in entry.attrib:
entry.set('failure', 'bind error: %s' % exc)
- self.logger.error("Unexpected failure in BindStructure: %s %s"
- % (entry.tag, entry.get('name')), exc_info=1)
+ if isinstance(exc, PluginExecutionError):
+ msg = "Failed to bind entry"
+ else:
+ msg = "Unexpected failure binding entry"
+ self.logger.error("%s %s:%s: %s" %
+ (msg, entry.tag, entry.get('name'), exc))
def Bind(self, entry, metadata):
""" Bind a single entry using the appropriate generator.