[Buildbot-devel] WithProperties: outdated docs?
Dmitry Nezhevenko
dion at dion.org.ua
Wed Jun 15 21:40:22 UTC 2011
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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://buildbot.net/pipermail/devel/attachments/20110616/8c9e049f/attachment.bin>
More information about the devel
mailing list