From 41808eb4d2256ebf8dedb8111bb02d04173bbb8e Mon Sep 17 00:00:00 2001 From: Adam Williamson Date: Jul 17 2019 18:05:01 +0000 Subject: Fix crash when whitelist file could not be found The 'whitelst' var referred to in the format string does not exist. 'self.whitelist' is the correct string to include here. Also, there's no point trying to read a whitelist from an empty string or any other false-y thing, so change the condition for when we just skip trying to read it a bit. Signed-off-by: Adam Williamson --- diff --git a/modular_functions.py b/modular_functions.py index 799bf6d..803d973 100755 --- a/modular_functions.py +++ b/modular_functions.py @@ -278,7 +278,7 @@ class TestSuite: """Reads the file with whitelisted modules and returns the content.""" # Some modules do not have the default streams and/or profiles set on purpose. # Their names can be load into the suite to prevent them from being reported. - if self.whitelist == None: + if not self.whitelist: whitelist = [] else: try: @@ -289,8 +289,8 @@ class TestSuite: whitelist.append(m.strip()) except FileNotFoundError: - print(f"File {whitelst} has not been found. Whitelist could not be read, proceeding without it.") - logging.error(f"File {whitelst} has not been found. Proceeding without it.") + print(f"File {self.whitelist} has not been found. Whitelist could not be read, proceeding without it.") + logging.error(f"File {self.whitelist} has not been found. Proceeding without it.") whitelist = [] return whitelist