diff --git a/master/buildbot/data/properties.py b/master/buildbot/data/properties.py index 89f0bc586d05..be21497d8835 100644 --- a/master/buildbot/data/properties.py +++ b/master/buildbot/data/properties.py @@ -38,12 +38,12 @@ class BuildPropertiesEndpoint(base.Endpoint): /builds/n:buildid/properties """ + @defer.inlineCallbacks def get(self, resultSpec, kwargs): - buildid = kwargs.get("buildid", None) - if buildid is None: - # fixme: this cannot work... - buildid = kwargs.get("build_number") - return self.master.db.builds.getBuildProperties(buildid) + retriever = base.NestedBuildDataRetriever(self.master, kwargs) + buildid = yield retriever.get_build_id() + build_properties = yield self.master.db.builds.getBuildProperties(buildid) + return build_properties class PropertiesListEndpoint(base.Endpoint): diff --git a/master/buildbot/test/unit/data/test_properties.py b/master/buildbot/test/unit/data/test_properties.py index 5e53e25745f5..23390d22e217 100644 --- a/master/buildbot/test/unit/data/test_properties.py +++ b/master/buildbot/test/unit/data/test_properties.py @@ -61,11 +61,12 @@ class BuildPropertiesEndpoint(endpoint.EndpointMixin, unittest.TestCase): def setUp(self): self.setUpEndpoint() self.db.insert_test_data([ + fakedb.Builder(id=1), fakedb.Buildset(id=28), - fakedb.BuildRequest(id=5, buildsetid=28), + fakedb.BuildRequest(id=5, buildsetid=28, builderid=1), fakedb.Master(id=3), fakedb.Worker(id=42, name="Friday"), - fakedb.Build(id=786, buildrequestid=5, masterid=3, workerid=42), + fakedb.Build(id=786, buildrequestid=5, masterid=3, workerid=42, builderid=1, number=5), fakedb.BuildProperty(buildid=786, name="year", value=1651, source="Wikipedia"), fakedb.BuildProperty(buildid=786, name="island_name", value="despair", source="Book"), ]) @@ -81,7 +82,7 @@ def test_get_properties(self): @defer.inlineCallbacks def test_get_properties_from_builder(self): - props = yield self.callGet(('builders', 1, 'builds', 786, 'properties')) + props = yield self.callGet(('builders', 1, 'builds', 5, 'properties')) self.assertEqual(props, {'year': (1651, 'Wikipedia'), 'island_name': ("despair", 'Book')}) diff --git a/newsfragments/data-BuildPropertiesEndpoint.bugfix b/newsfragments/data-BuildPropertiesEndpoint.bugfix new file mode 100644 index 000000000000..4075a9096d0a --- /dev/null +++ b/newsfragments/data-BuildPropertiesEndpoint.bugfix @@ -0,0 +1 @@ +``/builders/n:builderid/builds/n:build_number/properties`` endpoint would use ``build_number`` as ``buildid`` \ No newline at end of file