[Buildbot-devel] WithProperties: outdated docs?

Amber Yust ayust at yelp.com
Wed Jun 15 21:44:32 UTC 2011


If all you want to do is specify a default, why not use the
propname:-replacement syntax?

http://buildbot.net/buildbot/docs/current/WithProperties.html#WithProperties

~Amber

On Wed, Jun 15, 2011 at 2:40 PM, Dmitry Nezhevenko <dion at dion.org.ua> wrote:

> Hi,
>
> I've finally merged 0.8.4 with my local changes and observed issue with
> WithProperties.
>
> I've some very dummy step that just adds URL to published artifacts:
>
> class AddURLStep(BuildStep):
>
>    def __init__(self, linkName="", linkURL="", **kwargs):
>        BuildStep.__init__(self)
>
>        self.linkName = linkName
>        self.linkURL = linkURL
>
>        self.addFactoryArguments(linkName = linkName)
>        self.addFactoryArguments(linkURL = linkURL)
>
>    def start(self):
>        linkName = self.build.getProperties().render(self.linkName)
>        linkURL = self.build.getProperties().render(self.linkURL)
>        self.addURL(linkName, linkURL)
>        self.finished(SUCCESS)
>
> It looks like now there is no .render() method in properties. Code was
> refactored and now it's unclear for me which one to call?
>
> From my expectation, right one should be:
>
>        linkName = self.build.render(self.linkName)
>
> At least it works for me. However followed piece of config became broken:
>
> def _probably(props, default):
>        if props.has_key("configuration"):
>                v = props["configuration"]
>                if v == "":
>                        return default
>                return v
>        return default
>
> def probablyRelease(props):
>        return _probably(props, "Release")
>
> And here is a usage example:
>
>        WithProperties("%(configuration)s", configuration=probablyRelease)
>
> This looks pretty like in latest docs:
>
> http://buildbot.net/buildbot/docs/current/WithProperties.html#WithProperties
>
> However at runtime I'm getting followed error:
>
>  File "/opt/buildbot/master/buildbot/process/build.py", line 114, in
> render
>    return interfaces.IRenderable(value).getRenderingFor(self)
>  File "/opt/buildbot/master/buildbot/process/properties.py", line 228, in
> getRenderingFor
>    pmap.add_temporary_value(k, v(build))
>  File "/srv/buildmaster/master.cfg", line 175, in probablyRelease
>    return _probably(props, "Release")
>  File "/srv/buildmaster/master.cfg", line 167, in _probably
>    if props.has_key("configuration"):
> exceptions.AttributeError: Build instance has no attribute 'has_key'
>
> It looks like Build is passed instead of props. It looks like I'm using
> wrong way to render properties or documentation is outdated.
>
> Any ideas?
>
> --
> WBR, Dmitry
>
>
> ------------------------------------------------------------------------------
> EditLive Enterprise is the world's most technically advanced content
> authoring tool. Experience the power of Track Changes, Inline Image
> Editing and ensure content is compliant with Accessibility Checking.
> http://p.sf.net/sfu/ephox-dev2dev
> _______________________________________________
> 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/20110615/ece938ad/attachment.html>


More information about the devel mailing list