[Buildbot-devel] help with Python and Property
Todd Cooper
todd_cooper at yahoo.com
Sat Sep 24 04:16:56 UTC 2011
Meant to CC: list, but I replied to just Amber. This is what I sent her earlier.
I was just tried that and it works
thought of it myself just as I was about to check email
Must be something with the class function being used inside a function from another class in buildbot
Weird way to do it, but it works.
>________________________________
>From: Amber Yust <ayust at yelp.com>
>To: Todd Cooper <todd_cooper at yahoo.com>
>Cc: BuildBot Devel <buildbot-devel at lists.sourceforge.net>
>Sent: Friday, September 23, 2011 1:37 PM
>Subject: Re: [Buildbot-devel] help with Python and Property
>
>
>Alternatively, you could do this:
>
>
>def check_h4_slavename(rc,stdout,stderr):
> ghs_lmhost = "10.99.59.10"
> ghs_lmport = "2010"
> slavename = stdout
> if re.search("bigbuild", slavename):
> ghs_lmhost = "localhost"
> ghs_lmport = ""
> return { 'GHS_LMHOST' : ghs_lmhost,
> 'GHS_LMPORT' : ghs_lmport }
>
>incrFactory.addStep(shell.SetProperty(command=WithProperties("echo %(slavename)s"),
> extract_fn=check_h4_slavename,
> haltOnFailure=True))
>
>
>Since the command property *does* have WithProperties rendered, iirc.
>
>
>~Amber
>
>
>On Fri, Sep 23, 2011 at 10:35 AM, Amber Yust <ayust at yelp.com> wrote:
>
>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/2bb17f5a/attachment.html>
More information about the devel
mailing list