launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #07148
[Merge] lp:~allenap/maas/name-constraint-by-name-bug-984633 into lp:maas
Gavin Panella has proposed merging lp:~allenap/maas/name-constraint-by-name-bug-984633 into lp:maas.
Requested reviews:
Launchpad code reviewers (launchpad-reviewers)
Related bugs:
Bug #984633 in MAAS: "name constraint should filter on hostname"
https://bugs.launchpad.net/maas/+bug/984633
For more details, see:
https://code.launchpad.net/~allenap/maas/name-constraint-by-name-bug-984633/+merge/102474
--
https://code.launchpad.net/~allenap/maas/name-constraint-by-name-bug-984633/+merge/102474
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~allenap/maas/name-constraint-by-name-bug-984633 into lp:maas.
=== modified file 'src/maasserver/models.py'
--- src/maasserver/models.py 2012-04-16 10:00:51 +0000
+++ src/maasserver/models.py 2012-04-18 09:47:23 +0000
@@ -387,7 +387,7 @@
if constraints.get('name'):
available_nodes = available_nodes.filter(
- system_id=constraints['name'])
+ hostname=constraints['name'])
available_nodes = list(available_nodes[:1])
if len(available_nodes) == 0:
=== modified file 'src/maasserver/tests/test_api.py'
--- src/maasserver/tests/test_api.py 2012-04-16 10:00:51 +0000
+++ src/maasserver/tests/test_api.py 2012-04-18 09:47:23 +0000
@@ -1043,11 +1043,11 @@
desired_node = random.choice(available_nodes)
response = self.client.post(self.get_uri('nodes/'), {
'op': 'acquire',
- 'name': desired_node.system_id,
+ 'name': desired_node.hostname,
})
self.assertEqual(httplib.OK, response.status_code)
parsed_result = json.loads(response.content)
- self.assertEqual(desired_node.system_id, parsed_result['system_id'])
+ self.assertEqual(desired_node.hostname, parsed_result['hostname'])
def test_POST_acquire_would_rather_fail_than_disobey_constraint(self):
# If "acquire" is passed a constraint, it won't return a node
@@ -1077,13 +1077,13 @@
# If a name constraint is given, "acquire" attempts to allocate
# a node of that name.
node = factory.make_node(status=NODE_STATUS.READY, owner=None)
- system_id = node.system_id
response = self.client.post(self.get_uri('nodes/'), {
'op': 'acquire',
- 'name': system_id,
+ 'name': node.hostname,
})
self.assertEqual(httplib.OK, response.status_code)
- self.assertEqual(system_id, json.loads(response.content)['system_id'])
+ self.assertEqual(
+ node.hostname, json.loads(response.content)['hostname'])
def test_POST_acquire_constrains_by_name(self):
# Negative test for name constraint.