summaryrefslogtreecommitdiffstats
path: root/src/lib/Bcfg2/Server/Plugins/Properties.py
diff options
context:
space:
mode:
authorChris St. Pierre <chris.a.st.pierre@gmail.com>2012-11-06 13:34:01 -0500
committerChris St. Pierre <chris.a.st.pierre@gmail.com>2012-11-06 13:34:01 -0500
commitb7294206ffd1248997679eaaf5daa53a0a315054 (patch)
tree771bd356d0f234ce1885def0f4c4500c4097068e /src/lib/Bcfg2/Server/Plugins/Properties.py
parent5bc666e0f90b6bf1294003043f734de2d74d1a20 (diff)
downloadbcfg2-b7294206ffd1248997679eaaf5daa53a0a315054.tar.gz
bcfg2-b7294206ffd1248997679eaaf5daa53a0a315054.tar.bz2
bcfg2-b7294206ffd1248997679eaaf5daa53a0a315054.zip
Properties: allow lax decryption, where failure to decrypt an element is not fatal and parsing of that file continues
Diffstat (limited to 'src/lib/Bcfg2/Server/Plugins/Properties.py')
-rw-r--r--src/lib/Bcfg2/Server/Plugins/Properties.py12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/lib/Bcfg2/Server/Plugins/Properties.py b/src/lib/Bcfg2/Server/Plugins/Properties.py
index a3b9c6aec..2b4196ad6 100644
--- a/src/lib/Bcfg2/Server/Plugins/Properties.py
+++ b/src/lib/Bcfg2/Server/Plugins/Properties.py
@@ -210,12 +210,20 @@ class XMLPropertyFile(Bcfg2.Server.Plugin.StructFile, PropertyFile):
if not HAS_CRYPTO:
raise PluginExecutionError("Properties: M2Crypto is not "
"available: %s" % self.name)
+ strict = self.xdata.get(
+ "decrypt",
+ SETUP.cfp.get("properties", "decrypt",
+ default="strict")) == "strict"
for el in self.xdata.xpath("//*[@encrypted]"):
try:
el.text = self._decrypt(el)
except EVPError:
- raise PluginExecutionError("Failed to decrypt %s element "
- "in %s" % (el.tag, self.name))
+ msg = "Failed to decrypt %s element in %s" % (el.tag,
+ self.name)
+ if strict:
+ raise PluginExecutionError(msg)
+ else:
+ LOGGER.warning(msg)
Index.__doc__ = Bcfg2.Server.Plugin.StructFile.Index.__doc__
def _decrypt(self, element):