launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #14789
[Merge] lp:~jtv/maas/bug-1089464 into lp:maas
Jeroen T. Vermeulen has proposed merging lp:~jtv/maas/bug-1089464 into lp:maas.
Commit message:
Fix omission in getting cluster_uuid parameter from pxeconfig API request.
Requested reviews:
Launchpad code reviewers (launchpad-reviewers)
Related bugs:
Bug #1089464 in MAAS: "Passing cluster UUID to pxeconfig isn't done yet"
https://bugs.launchpad.net/maas/+bug/1089464
For more details, see:
https://code.launchpad.net/~jtv/maas/bug-1089464/+merge/139520
Raphael spotted a stupid mistake in one of my branches for bug 1084507 (just what you get when you're in a hurry and a simple bug fix takes more than a handful of branches and lots of time to run tests on each!) where a test didn't have a name starting with "test." And so Nose never ran it.
This branch fixes the test, and then satisfies it. I'll be backporting it to 1.2 as well.
Jeroen
--
https://code.launchpad.net/~jtv/maas/bug-1089464/+merge/139520
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~jtv/maas/bug-1089464 into lp:maas.
=== modified file 'src/maasserver/api.py'
--- src/maasserver/api.py 2012-12-04 09:52:46 +0000
+++ src/maasserver/api.py 2012-12-12 17:25:27 +0000
@@ -1607,7 +1607,11 @@
none, figures it out based on the requesting IP as a compatibility
measure. In that case, the result may be incorrect.
"""
- return find_nodegroup(request)
+ uuid = request.GET.get('cluster_uuid', None)
+ if uuid is None:
+ return find_nodegroup(request)
+ else:
+ return NodeGroup.objects.get(uuid=uuid)
def pxeconfig(request):
=== modified file 'src/maasserver/tests/test_api.py'
--- src/maasserver/tests/test_api.py 2012-12-04 09:52:46 +0000
+++ src/maasserver/tests/test_api.py 2012-12-12 17:25:27 +0000
@@ -3498,7 +3498,7 @@
compose_preseed_url(node),
json.loads(response.content)["preseed_url"])
- def find_nodegroup_for_pxeconfig_request_uses_cluster_uuid(self):
+ def test_find_nodegroup_for_pxeconfig_request_uses_cluster_uuid(self):
# find_nodegroup_for_pxeconfig_request returns the nodegroup
# identified by the cluster_uuid parameter, if given. It
# completely ignores the other node or request details, as shown
@@ -3506,7 +3506,7 @@
params = self.get_mac_params()
nodegroup = factory.make_node_group()
params['cluster_uuid'] = nodegroup.uuid
- request = RequestFactory.get(reverse('pxeconfig'), **params)
+ request = RequestFactory().get(reverse('pxeconfig'), params)
self.assertEqual(
nodegroup,
find_nodegroup_for_pxeconfig_request(request))