From 9acf4ecf5535cfea29a96e9cec9fc2c3434ab9bd Mon Sep 17 00:00:00 2001 From: Lukas Ruzicka Date: Jul 09 2019 13:47:06 +0000 Subject: Do not stop on success. --- diff --git a/modular_functions.py b/modular_functions.py index ba903ba..7b39c00 100755 --- a/modular_functions.py +++ b/modular_functions.py @@ -49,7 +49,7 @@ class TestSuite: logging.info('The DNF operation of module_list ran successfully (0)') else: result['dnf_module_list'] = raw.stderr.decode('utf-8') - logging.warning('The DNF operation of module_list did not run successfuly!') + logging.error('The DNF operation of module_list did not run successfuly!') raw = raw.stdout.decode('utf-8') @@ -68,7 +68,7 @@ class TestSuite: processed.append(x) logging.debug('The cleaned DNF output is:' + str('\n'.join(processed))) except IndexError: - logging.warning('The DNF output could not be properly parsed.') + logging.error('The DNF output could not be properly parsed.') raise strip = [re.split(r'\s\s+', x.strip()) for x in processed] @@ -88,7 +88,9 @@ class TestSuite: # two words in the first column, and there might be some of the following in others: # second column might be a comma (divides profiles), the third column starts with a capital letter, # or there might be some [] specification in the field. + logging.debug("The line from the output does not have four columns.") if ' ' in line[0]: + logging.debug("The module name contains an empty space. It probably consists of name and stream.") nameinstream = 0 if line[2][1].isupper() == True: nameinstream += 1 @@ -102,11 +104,13 @@ class TestSuite: name = l[0] line = [name, stream, line[1], line[2]] # Now, the line should have correct values. else: + logging.debug("The module name is correctly passed, the profiles and the info might be merged together.") wrongstring = line[2] profile = '' info = '' if ',' in wrongstring: # If there is a comma, however, it can be a flaw in the output and # we still might be able to recreate the profile and info out of it. + logging.debug("The profile might be incorrectly formed, trying to fix it.") pos = 0 for x in wrongstring: if x.isupper() == True: @@ -145,7 +149,7 @@ class TestSuite: module['stream'] = cleanstream except IndexError: module['stream'] = 'not available' - logging.info(f"The {line[0]} module does not provide any streams. Check 'dnf module list'.") + logging.error(f"The {line[0]} module does not provide any streams. Check 'dnf module list'.") try: # Parsing profile @@ -167,14 +171,14 @@ class TestSuite: module['profile'] = profiles except IndexError: module['profile'] = 'not available' - logging.info(f"The {line[0]} module probably does not provide any profiles. Check 'dnf module list'.") + logging.error(f"The {line[0]} module probably does not provide any profiles. Check 'dnf module list'.") try: # Parsing info module['info'] = line[3] except IndexError: module['info'] = 'not available' - logging.info(f"The {line[0]} module probably does not provide any info. Check 'dnf module list'.") + logging.error(f"The {line[0]} module probably does not provide any info. Check 'dnf module list'.") # Recording the module into a module database to be used by other methods. if modName not in modulelist.keys(): #If this is first occurence @@ -183,7 +187,7 @@ class TestSuite: if module not in modulelist[modName]: modulelist[modName].append(module) else: - pass + logging.error("Something bad happened when attempting to store the module in the overview.") self.modlist = modulelist self.store_results('dnf module list', result) @@ -219,7 +223,7 @@ class TestSuite: else: problem = raw.stderr.decode('utf-8') logging.warning(f"The operation {key} has NOT finished successfully, because of {problem}.") - print('The script must be run with sudo or under root! Check the log for further errors.') + print('There was a DNF problem! Check the log for further information.') result = 1 self.store_results(f'dnf module {operation}', result) return result @@ -240,7 +244,7 @@ class TestSuite: result = result + 100 if profile != None and profile not in line: result = result + 110 - break + #break else: result = 111 logging.info(f"The operation {key} has finished successfully.")