Jeroen T. Vermeulen has proposed merging lp:~jtv/maas/nodegroups-api into
lp:maas.
Requested reviews:
Launchpad code reviewers (launchpad-reviewers)
For more details, see:
https://code.launchpad.net/~jtv/maas/nodegroups-api/+merge/114562
What you see here is another very small step in allowing node-group workers to
send their DHCP lease updates to the server. (And later of course, we'll need
lots more API for the workers to talk to).
As pre-imped with Raphaël, I'm adding a “nodegroups” subtree to the API. All
it delivers for now is an index of registered node groups. It's not publicly
accessible — on the one hand, we have no particular reason to make it publicly
accessible as yet, and it's easier. On the other hand, it'd be just too easy
to expose NodeGroup fields to anonymous visitors by accident, including the
ones that hold API credentials. And on the gripping hand, the immediate reason
why I'm adding this in the first place is to support an update_leases operation
which really should only be available to the workers.
(You'll note at this point that we have no worker authentication yet. I put a
separate task for that on the board.)
Jeroen
--
https://code.launchpad.net/~jtv/maas/nodegroups-api/+merge/114562
Your team Launchpad code reviewers is requested to review the proposed merge of
lp:~jtv/maas/nodegroups-api into lp:maas.
=== modified file 'src/maasserver/tests/test_api.py'
--- src/maasserver/tests/test_api.py 2012-07-04 14:24:27 +0000
+++ src/maasserver/tests/test_api.py 2012-07-12 05:11:21 +0000
@@ -2273,3 +2273,20 @@
for param in self.get_params()
}
self.assertEqual(expected, observed)
+
+
+class TestNodeGroupsAPI(APITestCase):
+
+ def test_nodegroups_index_lists_nodegroups(self):
+ # The nodegroups index lists node groups for the MAAS.
+ nodegroup = factory.make_node_group()
+ response = self.client.get(self.get_uri('nodegroups/'))
+ self.assertEqual(httplib.OK, response.status_code)
+ self.assertIn(nodegroup.name, json.loads(response.content))
+
+
+class TestAnonNodeGroupsAPI(AnonAPITestCase):
+
+ def test_nodegroups_require_authentication(self):
+ response = self.client.get(self.get_uri('nodegroups/'))
+ self.assertEqual(httplib.UNAUTHORIZED, response.status_code)
_______________________________________________
Mailing list: https://launchpad.net/~launchpad-reviewers
Post to : [email protected]
Unsubscribe : https://launchpad.net/~launchpad-reviewers
More help : https://help.launchpad.net/ListHelp