[Buildbot-devel] problem in overriding FileUpload.__init__()

Giovanni Gherdovich g.gherdovich at gmail.com
Sun May 25 19:04:30 UTC 2014


Hi all,

I am having problems in subclassing buildbot.steps.transfer.FileUpload
and overriding its __init__() method.

My system has Buildbot 0.8.1 and Twisted 10.1.0;
I know it's quite outdated, but the cluster is run by people
who don't like to change things and I don't have a say on it.

The thing is that if I subclass FileUpload with

---------------------------------------------------
class FileUpload2(FileUpload):
    def __init__(self, slavesrc, masterdest):
        FileUpload.__init__(self,
                            slavesrc=slavesrc,
                            masterdest=masterdest)
---------------------------------------------------

i.e., I do nothing but limiting the arguments of the constructor to two,
and instantiate it with

---------------------------------------------------
f = factory.BuildFactory()
f.addStep(FileUpload2(slavesrc="/etc/passwd",
                      masterdest="~/foo"))
---------------------------------------------------

I get the following error in the twisted.log of the master:

---------------------------------------------------
2014-05-25 20:31:38+0200 [Broker,1,127.0.0.1] <Build
buildbot-full>.startBuild
2014-05-25 20:31:38+0200 [Broker,1,127.0.0.1] error while creating step,
factory=__builtin__.FileUpload2,
                                              args={'masterdest': '~/foo',
'maxsize': None, 'workdir': None, 'mode': None, 'blocksize': 16384,
'slavesrc': '/etc/passwd'}
2014-05-25 20:31:38+0200 [Broker,1,127.0.0.1] Build.setupBuild failed
2014-05-25 20:31:38+0200 [Broker,1,127.0.0.1] Unhandled Error
        Traceback (most recent call last):
          File
"/home/buildbot/sandbox/local/lib/python2.7/site-packages/Twisted-10.1.0-py2.7-linux-x86_64.egg/twisted/internet/defer.py",
line 318, in callback
            self._startRunCallbacks(result)
          File
"/home/buildbot/sandbox/local/lib/python2.7/site-packages/Twisted-10.1.0-py2.7-linux-x86_64.egg/twisted/internet/defer.py",
line 424, in _startRunCallbacks
            self._runCallbacks()
          File
"/home/buildbot/sandbox/local/lib/python2.7/site-packages/Twisted-10.1.0-py2.7-linux-x86_64.egg/twisted/internet/defer.py",
line 441, in _runCallbacks
            self.result = callback(self.result, *args, **kw)
          File
"/home/buildbot/sandbox/local/lib/python2.7/site-packages/buildbot-0.8.1-py2.7.egg/buildbot/process/builder.py",
line 840, in _startBuild_2
            d = build.startBuild(bs, self.expectations, sb)
        --- <exception caught here> ---
          File
"/home/buildbot/sandbox/local/lib/python2.7/site-packages/buildbot-0.8.1-py2.7.egg/buildbot/process/base.py",
line 214, in startBuild
            self.setupBuild(expectations) # create .steps
          File
"/home/buildbot/sandbox/local/lib/python2.7/site-packages/buildbot-0.8.1-py2.7.egg/buildbot/process/base.py",
line 265, in setupBuild
            step = factory(**args)
        exceptions.TypeError: __init__() got an unexpected keyword argument
'maxsize'
---------------------------------------------------

Here my complete minimal master.cfg:
there is only one BuildStep, which moves /etc/passwd from the slave
to a ~/foo file on the master.

---------------------------------------------------
# -*- python -*-
from buildbot.buildslave import BuildSlave
from buildbot.scheduler import Scheduler
from buildbot.process import factory
from buildbot.status import html
from buildbot.status.web import auth, authz
from buildbot.steps.transfer import FileUpload
from buildbot.changes.pb import PBChangeSource

c = BuildmasterConfig = {}
c['db_url'] = "sqlite:///state.sqlite"
c['slaves'] = [BuildSlave("example-slave", "pass")]
c['slavePortnum'] = 9989

c['change_source'] = PBChangeSource()

c['schedulers'] = []
c['schedulers'].append(Scheduler(name="all", branch=None,
                                 treeStableTimer=None,
                                 builderNames=["buildbot-full"]))

class FileUpload2(FileUpload):
    def __init__(self, slavesrc, masterdest):
        FileUpload.__init__(self,
                            slavesrc=slavesrc,
                            masterdest=masterdest)


f = factory.BuildFactory()
f.addStep(FileUpload2(slavesrc="/etc/passwd",
                     masterdest="~/foo"))

b = {'name': "buildbot-full",
      'slavename': "example-slave",
      'builddir': "full",
      'factory': f,
      }
c['builders'] = [b]
c['status'] = []

authz_cfg=authz.Authz(
    gracefulShutdown = False,
    forceBuild = False,
    forceAllBuilds = False,
    pingBuilder = False,
    stopBuild = False,
    stopAllBuilds = False,
    cancelPendingBuild = False,
)
c['status'].append(html.WebStatus(http_port=8010, authz=authz_cfg))
c['buildbotURL'] = "http://localhost:8010/"
---------------------------------------------------

Regards,
GGhh
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://buildbot.net/pipermail/devel/attachments/20140525/1cf618e7/attachment.html>


More information about the devel mailing list