3

I'm currently facing problems when trying to read in the logfiles after calling scripts on a slave.

As a test, I'm calling on the slave a batch file "test.bat" which echoes "OK". I'd then like to use Logobservers to read into the stdio, by overriding a LogLineObserver class, but the method outLineReceived which is supposed to get the output is never called.

Here are the two classes I use:

class MyObserver(LogLineObserver):
    numTest=0
    def outLineReceived(self,line):
        if "OK" in line: 
           self.numTest+=1

class CustomStep(ShellCommand):
    def __init__(self,**kwargs):
        ShellCommand.__init__(self,workdir=WorkdironSlave,command=["call","test.bat"],**kwargs)
        self.TestObserver=MyObserver()
        self.addLogObserver('stdio',self.TestObserver)

I've also tried to use log files in my Shellcommand, with logfiles={"testlog":"test.log"}(where test.log is a file containing "OK" created in the Slave directory by the batch file). I then call my Logobserver with self.addLogObserver('testlog',self.TestObserver).

I've also tried to add this constructor to my log observer. def init(self): LogLineObserver.__init(self) This is called by the custom ShellCommand but the method outLineReceived is still never called.

The factory I use is also defined like this :

myFactory=BuildFactory()
myFactory.addStep(CustomStep())

The final purpose of this will be to call new steps depending on what is written in the stdio file.

I'm using buildbot v0.8.7p1

Any idea on why this "outLineReceived" method is never called, or on what changes should I do to be able to read into the stdio or "test.log" file ?

Thanks

Victor
  • 31
  • 3

0 Answers0