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

Giovanni Gherdovich g.gherdovich at gmail.com
Sun May 25 21:43:51 UTC 2014


> On Sun, May 25, 2014 at 9:42 PM, Dustin J. Mitchell <dustin at v.igoro.us>
wrote:
> >
> > The problem has to do with the use of steps as step factories -- that
> > single step object in your master.cfg needs to be able to create a new
> > step instance for each build, and thus stores its constructor
> > arguments, even the defaults.  Check out how FileUpload handles its
> > args - there was a function named something like addFactoryArgs that
> > you'll need to call for any custom args you add.

yup, that made the trick. The following snipped registers the extra arg as
you say,
and works as intended:

---------------------------------------------------------------
class FileUpload2(FileUpload):
    def __init__(self, slavesrc, masterdest,
                 workdir=None, maxsize=None, blocksize=16*1024, mode=None,
EXTRA_ARG=None,
                 **buildstep_kwargs):
        FileUpload.__init__(self, slavesrc, masterdest,
                            workdir=None, maxsize=None, blocksize=16*1024,
mode=None,
                            **buildstep_kwargs)
        self.addFactoryArguments(EXTRA_ARG=EXTRA_ARG)
        self.EXTRA_ARG=EXTRA_ARG

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

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


More information about the devel mailing list