[Buildbot-devel] Setting creating a command with WithProperties throws an exception

Brian Warner warner-buildbot at lothar.com
Sun Nov 26 08:21:46 UTC 2006


Benoit Sigoure <tsuna at lrde.epita.fr> writes:

> Hi
> sorry if this is a lame question but here is what I get:
>
> --------
> f_kernel1.addStep(step.ShellCommand,
>   command=WithProperties('$HOME/svn/buildfarm/slaves/upload_build.sh
> "%(buildername)s" "%(revision)s" "$HOME/built/kernel1"'),
>   description='uploading release', descriptionDone='upload release')

> Traceback (most recent call last):
>     raise InsecureJelly("Class not allowed for instance: %s %s" %
> twisted.spread.jelly.InsecureJelly: Class not allowed for instance:
> buildbot.process.step.WithProperties <buildbot.process.step.WithProperties
> instance at 0x40948f2c>

So unfortunately you can only use WithProperties() in the list form of a
ShellCommand command. That is, you can do:

 command=["string", WithProperties(stuff), "other string"]

but you can't do:

 command=WithProperties(stuff)

The ShellCommand doesn't realize this, so when it notices that you aren't
using the list form for command=, it assumes you're using a string, and it
sends the whole string over to the far end. The RPC mechanism doesn't know
how to serialize the WithProperties instance and so you get the InsecureJelly
error.

Unfortunately, with the list form for command=, you aren't getting shell
expansion of that $HOME variable.

Try something like this (warning, untested):

 command=["/bin/sh", "-c", "$HOME/svn/buildfarm/slaves/upload_build.sh",
          WithProperties("%s", "buildername"),
          WithProperties("%s", "revision"),
          "$HOME/built/kernel1"]

I think that might get you both the $HOME expansion and the WithProperties
interpolation.

I'll add a suggestion to this effect to the manual (and an assertion to the
code to make it fail in a less confusing place).

cheers,
 -Brian




More information about the devel mailing list