[Buildbot-devel] How do you subclass a Buildstep?

Giovanni Gherdovich g.gherdovich at gmail.com
Sun May 31 09:41:03 UTC 2015


Hello,

I am trying to subclass a ShellCommand because I need to
add an additional argument to its constructor.
I remember that from 0.8.8 on (specifically, the commit
https://github.com/buildbot/buildbot/commit/a8f8877 )
there is no more need to register __init__ arguments with
addFactoryArguments() , so in my 0.8.10 instance I am doing

-- -- >8 -- -- >8 -- -- >8 -- -- >8 -- -- >8 -- -- >8 -- -- >8
class Frob(ShellCommand):
    def __init__(self, foo, *args, **kwargs):
        super(ShellCommand, self).__init__(*args, **kwargs)
        self.foo = foo

c = BuildmasterConfig = {}
c['slaves'] = [BuildSlave("x", "x")]
c['protocols'] = {'pb': {'port': 9989}}
c['schedulers'] = []
c['schedulers'].append(SingleBranchScheduler(
                            name="all",

change_filter=filter.ChangeFilter(branch='master'),
                            treeStableTimer=None,
                            builderNames=["runtests"]))
c['schedulers'].append(ForceScheduler(
                            name="force",
                            builderNames=["runtests"]))


factory = BuildFactory([Frob(foo='foo', command='echo yup')])

c['builders'] = []
c['builders'].append(
    BuilderConfig(name="runtests",
      slavenames=["x"],
      factory=factory))
-- -- >8 -- -- >8 -- -- >8 -- -- >8 -- -- >8 -- -- >8 -- -- >8

but I end up with this in the log of my master:

-- -- >8 -- -- >8 -- -- >8 -- -- >8 -- -- >8 -- -- >8 -- -- >8
[-] Configuration Errors:
[-]   <class 'Frob'>.__init__ got unexpected keyword argument(s) ['command']
[-] Halting master.
[-] Main loop terminated.
[-] Server Shut Down.
-- -- >8 -- -- >8 -- -- >8 -- -- >8 -- -- >8 -- -- >8 -- -- >8

What's happening?
I did some inspections and seems like when my master.cfg is "exec" -ed,
at line 156 of master/buildbot/config.py (method loadConfig of class
MasterConfig)
https://github.com/buildbot/buildbot/blob/eight/master/buildbot/config.py#L156
the global variable "_errors" is filled with the "configuration error" I
report above.

Before going further, I ask here if this smells like a buildbot bug or
if I am doing things wrong.

Cheers,
Giovanni
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://buildbot.net/pipermail/devel/attachments/20150531/c2cabecf/attachment.html>


More information about the devel mailing list