Bug 694392 - printing failed cleanup phase ends with traceback
Summary: printing failed cleanup phase ends with traceback
Keywords:
Status: CLOSED DUPLICATE of bug 692819
Alias: None
Product: Fedora
Classification: Fedora
Component: beakerlib
Version: 14
Hardware: Unspecified
OS: Unspecified
unspecified
high
Target Milestone: ---
Assignee: Petr Muller
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard: Patch
Depends On:
Blocks: 545868
TreeView+ depends on / blocked
 
Reported: 2011-04-07 08:11 UTC by Jan Hutař
Modified: 2016-09-20 02:07 UTC (History)
4 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2011-04-07 10:38:54 UTC
Type: ---


Attachments (Terms of Use)

Description Jan Hutař 2011-04-07 08:11:10 UTC
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"):

Comment 1 Jan Pazdziora 2011-04-07 08:32:41 UTC
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?

Comment 2 Petr Muller 2011-04-07 10:38:54 UTC

*** This bug has been marked as a duplicate of bug 692819 ***


Note You need to log in before you can comment on or make changes to this bug.