Hide Forgot
Description of problem: Recently, we have started to get tracebacks when reporting failed cleanup phase. It is caused by an attempt to report result 'WARN' instead of 'WARNING'. It is not clear which one is the correct one (see docs for rlReport, but see what code in Python functions printLog and getAllowedSeverities expects). Version-Release number of selected component (if applicable): beakerlib-1.3-4.el5 How reproducible: always Steps to Reproduce: 1. report failed cleanup phase Actual results: :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: [ LOG ] :: Cleanup :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: [ FAIL ] :: Running 'blablabla' (Expected 0, got 1) :: [ LOG ] :: Duration: 0s :: [ LOG ] :: Assertions: 0 good, 1 bad Traceback (most recent call last): File "/usr/bin/beakerlib-journalling", line 468, in ? createLog(options.testid, options.severity) File "/usr/bin/beakerlib-journalling", line 181, in createLog printPhaseLog(nod,severity) File "/usr/bin/beakerlib-journalling", line 123, in printPhaseLog printLog("RESULT: %s" % phaseName, phaseResult) File "/usr/bin/beakerlib-journalling", line 70, in printLog color = termColors[prefix] KeyError: u'WARN' Expected results: Should work Additional info: Relevant piece of journal.xml have: <phase endtime="2011-04-07 03:38:46 EDT" name="Cleanup" result="WARN" score="1" starttime="2011-04-07 03:38:46 EDT" type="WARN"><test message="Running 'blablabla' (Expected 0, got 1)">FAIL</test></phase> To fix traceback and avoid future similar occurrences, this might be a patch: --- /usr/bin/beakerlib-journalling.ORIG 2011-04-07 03:37:44.000000000 -0400 +++ /usr/bin/beakerlib-journalling 2011-04-07 03:38:19.000000000 -0400 @@ -66,7 +66,7 @@ def printLog(message, prefix="LOG"): color = uncolor = "" - if sys.stdout.isatty() and prefix in "PASS FAIL INFO WARNING": + if sys.stdout.isatty() and prefix in ("PASS", "FAIL", "INFO", "WARNING"): color = termColors[prefix] uncolor = "\033[0m" for line in message.split("\n"):
Wouldn't it be better to just add the 'WARN' color to that termColors = { "PASS": "\033[0;32m", "FAIL": "\033[0;31m", "INFO": "\033[0;34m", "WARNING": "\033[0;33m" } hash?
*** This bug has been marked as a duplicate of bug 692819 ***