From 1bdb14055dd1b2395047793ee28c17bbae65c845 Mon Sep 17 00:00:00 2001 From: "Chris St. Pierre" Date: Thu, 27 Sep 2012 14:33:34 -0400 Subject: wrote unit tests for Properties --- src/lib/Bcfg2/Server/Plugins/Properties.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'src/lib/Bcfg2/Server') diff --git a/src/lib/Bcfg2/Server/Plugins/Properties.py b/src/lib/Bcfg2/Server/Plugins/Properties.py index 1d5bdbcfc..d9e622645 100644 --- a/src/lib/Bcfg2/Server/Plugins/Properties.py +++ b/src/lib/Bcfg2/Server/Plugins/Properties.py @@ -41,8 +41,7 @@ class PropertyFile(Bcfg2.Server.Plugin.StructFile): raise PluginExecutionError(msg) try: - open(self.name, - "wb").write( + open(self.name, "wb").write( lxml.etree.tostring(self.xdata, xml_declaration=False, pretty_print=True).decode('UTF-8')) @@ -60,7 +59,7 @@ class PropertyFile(Bcfg2.Server.Plugin.StructFile): if os.path.exists(schemafile): try: schema = lxml.etree.XMLSchema(file=schemafile) - except: + except lxml.etree.XMLSchemaParseError: err = sys.exc_info()[1] raise PluginExecutionError("Failed to process schema for %s: " "%s" % (self.name, err)) @@ -105,6 +104,8 @@ class PropertyFile(Bcfg2.Server.Plugin.StructFile): # error is raised below pass except KeyError: + # bruteforce_decrypt raises an EVPError with a sensible + # error message, so we just let it propagate up the stack return bruteforce_decrypt(element.text, passphrases=passes.values(), algorithm=get_algorithm(SETUP)) -- cgit v1.2.3-1-g7c22