Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updated parsing of true/false values for ini file download flags with… #20

Merged
merged 1 commit into from
Aug 7, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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