From d74dd31d2301d7e0c5479192405bdc55a70b3c62 Mon Sep 17 00:00:00 2001 From: Daniel Black Date: Fri, 13 Dec 2013 10:00:34 +0000 Subject: [PATCH] BF: corrected tests for missing jail Previously tests relied on the missing filter to trigger the conditions required for a missing jail. We now handle this explicitly. --- client/configreader.py | 2 +- client/jailreader.py | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/client/configreader.py b/client/configreader.py index 96aab5f3..470f029f 100644 --- a/client/configreader.py +++ b/client/configreader.py @@ -112,7 +112,7 @@ class ConfigReader(SafeConfigParserWithIncludes): except NoSectionError, e: # No "Definition" section or wrong basedir logSys.error(e) - values[option[1]] = option[2] + return False except NoOptionError: if not option[2] is None: logSys.warn("'%s' not defined in '%s'. Using default one: %r" diff --git a/client/jailreader.py b/client/jailreader.py index 1b5bf1ae..d7c7b84c 100644 --- a/client/jailreader.py +++ b/client/jailreader.py @@ -54,7 +54,7 @@ class JailReader(ConfigReader): return ConfigReader.read(self, "jail") def isEnabled(self): - return self.__force_enable or self.__opts["enabled"] + return self.__force_enable or ( self.__opts and self.__opts["enabled"] ) @staticmethod def _glob(path): @@ -84,6 +84,8 @@ class JailReader(ConfigReader): ["string", "filter", ""], ["string", "action", ""]] self.__opts = ConfigReader.getOptions(self, self.__name, opts) + if not self.__opts: + return False if self.isEnabled(): # Read filter