summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/lib/Bcfg2/Server/Plugin/helpers.py3
-rw-r--r--src/lib/Bcfg2/Server/Plugins/Cfg/CfgEncryptedGenerator.py4
-rw-r--r--src/lib/Bcfg2/Server/Plugins/Cfg/__init__.py7
-rw-r--r--src/lib/Bcfg2/Server/Plugins/Properties.py13
4 files changed, 15 insertions, 12 deletions
diff --git a/src/lib/Bcfg2/Server/Plugin/helpers.py b/src/lib/Bcfg2/Server/Plugin/helpers.py
index 8e383ba97..bbceb1989 100644
--- a/src/lib/Bcfg2/Server/Plugin/helpers.py
+++ b/src/lib/Bcfg2/Server/Plugin/helpers.py
@@ -198,6 +198,9 @@ class FileBacked(object):
except IOError:
err = sys.exc_info()[1]
LOGGER.error("Failed to read file %s: %s" % (self.name, err))
+ except:
+ err = sys.exc_info()[1]
+ LOGGER.error("Failed to parse file %s: %s" % (self.name, err))
def Index(self):
""" Index() is called by :func:`HandleEvent` every time the
diff --git a/src/lib/Bcfg2/Server/Plugins/Cfg/CfgEncryptedGenerator.py b/src/lib/Bcfg2/Server/Plugins/Cfg/CfgEncryptedGenerator.py
index 98a807602..26faf6e2c 100644
--- a/src/lib/Bcfg2/Server/Plugins/Cfg/CfgEncryptedGenerator.py
+++ b/src/lib/Bcfg2/Server/Plugins/Cfg/CfgEncryptedGenerator.py
@@ -42,9 +42,7 @@ class CfgEncryptedGenerator(CfgGenerator):
self.data = bruteforce_decrypt(self.data, setup=SETUP,
algorithm=get_algorithm(SETUP))
except EVPError:
- msg = "Failed to decrypt %s" % self.name
- LOGGER.error(msg)
- raise PluginExecutionError(msg)
+ raise PluginExecutionError("Failed to decrypt %s" % self.name)
handle_event.__doc__ = CfgGenerator.handle_event.__doc__
def get_data(self, entry, metadata):
diff --git a/src/lib/Bcfg2/Server/Plugins/Cfg/__init__.py b/src/lib/Bcfg2/Server/Plugins/Cfg/__init__.py
index fe53ea809..58f6e1e42 100644
--- a/src/lib/Bcfg2/Server/Plugins/Cfg/__init__.py
+++ b/src/lib/Bcfg2/Server/Plugins/Cfg/__init__.py
@@ -378,7 +378,12 @@ class CfgEntrySet(Bcfg2.Server.Plugin.EntrySet):
(action, event.filename))
self.debug_log("%s handling %s event on %s" %
(hdlr.__name__, action, event.filename))
- self.entry_init(event, hdlr)
+ try:
+ self.entry_init(event, hdlr)
+ except: # pylint: disable=W0702
+ err = sys.exc_info()[1]
+ LOGGER.error("Cfg: Failed to parse %s: %s" %
+ (event.filename, err))
return
elif hdlr.ignore(event, basename=self.path):
return
diff --git a/src/lib/Bcfg2/Server/Plugins/Properties.py b/src/lib/Bcfg2/Server/Plugins/Properties.py
index aef5238c6..a3b9c6aec 100644
--- a/src/lib/Bcfg2/Server/Plugins/Properties.py
+++ b/src/lib/Bcfg2/Server/Plugins/Properties.py
@@ -208,17 +208,14 @@ class XMLPropertyFile(Bcfg2.Server.Plugin.StructFile, PropertyFile):
Bcfg2.Server.Plugin.StructFile.Index(self)
if self.xdata.get("encryption", "false").lower() != "false":
if not HAS_CRYPTO:
- msg = "Properties: M2Crypto is not available: %s" % self.name
- LOGGER.error(msg)
- raise PluginExecutionError(msg)
+ raise PluginExecutionError("Properties: M2Crypto is not "
+ "available: %s" % self.name)
for el in self.xdata.xpath("//*[@encrypted]"):
try:
el.text = self._decrypt(el)
except EVPError:
- msg = "Failed to decrypt %s element in %s" % (el.tag,
- self.name)
- LOGGER.error(msg)
- raise PluginExecutionError(msg)
+ raise PluginExecutionError("Failed to decrypt %s element "
+ "in %s" % (el.tag, self.name))
Index.__doc__ = Bcfg2.Server.Plugin.StructFile.Index.__doc__
def _decrypt(self, element):
@@ -318,6 +315,7 @@ class Properties(Bcfg2.Server.Plugin.Plugin,
global SETUP # pylint: disable=W0603
Bcfg2.Server.Plugin.Plugin.__init__(self, core, datastore)
Bcfg2.Server.Plugin.Connector.__init__(self)
+ SETUP = core.setup
try:
self.store = PropDirectoryBacked(self.data, core.fam)
except OSError:
@@ -326,7 +324,6 @@ class Properties(Bcfg2.Server.Plugin.Plugin,
err)
raise Bcfg2.Server.Plugin.PluginInitError
- SETUP = core.setup
__init__.__doc__ = Bcfg2.Server.Plugin.Plugin.__init__.__doc__
def get_additional_data(self, metadata):