[Buildbot-devel] help with Python and Property

Amber Yust ayust at yelp.com
Fri Sep 23 17:35:57 UTC 2011


That's not what SetProperty is designed to do - it won't render
WithProperties blocks from you.

I'd suggest using a doStepIf function that always returns True, but first
looks up the slavename in step.build.properties and sets the new property.
(doStepIf functions are passed the step object as their argument.)

~Amber

On Fri, Sep 23, 2011 at 8:30 AM, Todd Cooper <todd_cooper at yahoo.com> wrote:

> I am fairly new to Python and I am having a problem with an accessor
> function to the property.
>
> Problem is I want to set a property of  the build depending on the slave
> name.
>
> How can I pass a result of the Property or WithProperties to re.search?
> It keeps giving me the error<type 'exceptions.TypeError'>: expected string
> or buffer
>
> def check_h4_slavename(rc,stdout,stderr):
>     ghs_lmhost = "10.99.59.10"
>     ghs_lmport = "2010"
>     slavename = WithProperties("%(slavename)s")
>     if re.search("bigbuild", slavename):
>         ghs_lmhost = "localhost"
>         ghs_lmport = ""
>     return { 'GHS_LMHOST' : ghs_lmhost,
>              'GHS_LMPORT' : ghs_lmport }
>
> incrFactory.addStep(shell.SetProperty(command="echo hello",
>                                       extract_fn=check_h4_slavename,
>                                       haltOnFailure=True))
>
>
>
>
> ------------------------------------------------------------------------------
> All of the data generated in your IT infrastructure is seriously valuable.
> Why? It contains a definitive record of application performance, security
> threats, fraudulent activity, and more. Splunk takes this data and makes
> sense of it. IT sense. And common sense.
> http://p.sf.net/sfu/splunk-d2dcopy2
> _______________________________________________
> Buildbot-devel mailing list
> Buildbot-devel at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/buildbot-devel
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://buildbot.net/pipermail/devel/attachments/20110923/8bc3c2cb/attachment.html>


More information about the devel mailing list