[Buildbot-devel] Problem (and solution) while accessing cmd.log
Carl Dionne
cdionne at quazal.com
Thu Nov 23 16:07:35 UTC 2006
I'm trying to setup a custom step similar to TreeSize, which accesses
and parses the output log, but I could not get TreeSize to work
properly. With all combinations of windows or linux client or server
I've tried, the call to commandComplete ended up raising an exception
while executing cmd.log.getText(), since log wasn't found in cmd.
To resolve the issue, I am now hooked in createSummary instead, and it
works fine.
I would still like to understand why it didn't work initially. Is this
a problem in TreeSize, or is there something I don't understand about
how to use it?
Thanks!
Carl
e.g.
class TreeSize(ShellCommand):
name = "treesize"
command = ["du", "-s", "."]
kb = None
def commandComplete(self, cmd):
out = cmd.log.getText()
m = re.search(r'^(\d+)', out)
if m:
self.kb = int(m.group(1))
def evaluateCommand(self, cmd):
if cmd.rc != 0:
return FAILURE
if self.kb is None:
return WARNINGS # not sure how 'du' could fail, but whatever
return SUCCESS
def getText(self, cmd, results):
if self.kb is not None:
return ["treesize", "%d kb" % self.kb]
return ["treesize", "unknown"]
has became:
class TreeSize(ShellCommand):
name = "treesize"
command = ["du", "-s", "."]
kb = None
def createSummary(self,log):
out = log.getText()
m = re.search(r'^(\d+)', out)
if m:
self.kb = int(m.group(1))
def evaluateCommand(self, cmd):
if cmd.rc != 0:
return FAILURE
if self.kb is None:
return WARNINGS # not sure how 'du' could fail, but whatever
return SUCCESS
def getText(self, cmd, results):
if self.kb is not None:
return ["treesize", "%d kb" % self.kb]
return ["treesize", "unknown"]
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://buildbot.net/pipermail/devel/attachments/20061123/3c329519/attachment.html>
More information about the devel
mailing list