From 008fec3efb4f6a905c7ca2ea8746fb83692376b1 Mon Sep 17 00:00:00 2001 From: Alan Greer Date: Mon, 7 Aug 2017 09:58:53 +0100 Subject: [PATCH] Updated parsing of true/false values for ini file download flags within the percival configuration file. --- percival/carrier/configuration.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/percival/carrier/configuration.py b/percival/carrier/configuration.py index 883d6d8..e66cfe6 100644 --- a/percival/carrier/configuration.py +++ b/percival/carrier/configuration.py @@ -481,17 +481,17 @@ def get_ini_file(self, item): return value def get_ini_file_download(self, item): + value = False if "Configuration" not in self.conf.sections(): raise_with_traceback(RuntimeError("Configuration section not found in ini file %s" % str(self._ini_filename))) - value = self.conf.get("Configuration", item).strip("\"") - self.log.debug("Checking for %s in percival control config file. Raw value: %s", item, value) - if isinstance(value, str): - if 'false' in value.lower(): - value = False - elif 'true' in value.lower(): - value = True + raw_value = self.conf.get("Configuration", item).strip("\"") + self.log.debug("Checking for %s in percival control config file. Raw value: %s", item, raw_value) + if 'false' in str(raw_value).lower(): + value = False + elif 'true' in str(raw_value).lower(): + value = True else: - value = bool(value) + self.log.error("Could not parse %s in percival control config file. Raw value: %s", item, raw_value) self.log.debug(" Processed value: %s", value) return value