Skip to content

Commit

Permalink
Updated parsing of true/false values for ini file download flags with…
Browse files Browse the repository at this point in the history
…in the

percival configuration file.
  • Loading branch information
ajgdls committed Aug 7, 2017
1 parent 0f7a6c1 commit 008fec3
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions percival/carrier/configuration.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 008fec3

Please sign in to comment.