Merge lp:~jtv/maas/node-nodegroup-api-ui into lp:maas/trunk
| Status: | Merged |
|---|---|
| Approved by: | Jeroen T. Vermeulen on 2012-09-21 |
| Approved revision: | 1026 |
| Merged at revision: | 1042 |
| Proposed branch: | lp:~jtv/maas/node-nodegroup-api-ui |
| Merge into: | lp:maas/trunk |
| Diff against target: |
532 lines (+276/-34) 10 files modified
src/maasserver/fields.py (+81/-1) src/maasserver/forms.py (+38/-13) src/maasserver/migrations/0027_add_tag_table.py (+3/-1) src/maasserver/models/tag.py (+1/-1) src/maasserver/preseed.py (+1/-1) src/maasserver/templates/maasserver/snippets.html (+4/-0) src/maasserver/tests/test_fields.py (+89/-3) src/maasserver/tests/test_forms.py (+57/-10) src/maasserver/tests/test_node.py (+1/-1) src/maasserver/tests/test_tag.py (+1/-3) |
| To merge this branch: | bzr merge lp:~jtv/maas/node-nodegroup-api-ui |
| Related bugs: |
| Reviewer | Review Type | Date Requested | Status |
|---|---|---|---|
| Raphaël Badin (community) | Approve on 2012-09-21 | ||
| John A Meinel | 2012-09-21 | Approve on 2012-09-21 | |
|
Review via email:
|
|||
Commit Message
Allow node-group selection when creating a node in API or UI.
Node groups are selected by subnet: any IP address in a node group's subnet identifies that node group. It could be the node's IP, or the cluster manager's, or the broadcast address, or any other IP in the subnet. This requires a node group to have an interface (subnet) defined before nodes can be added to it, and an IP in the subnet must not be in any other node group's subnet.
Description of the Change
See commit message. Discussed with Raphaël, but then again with Julian which led to a different solution.
A custom field is required to enable the form to identify nodegroups by something other than “id.”
I hit some problems in testing because initialize_
Jeroen
- 1023. By Jeroen T. Vermeulen on 2012-09-21
-
Merge trunk, resolve conflicts.
- 1024. By Jeroen T. Vermeulen on 2012-09-21
-
Added tests, as per review call with jam.
| Raphaël Badin (rvb) wrote : | # |
Looks good. A few remarks ([0] is probably the most important one).
[0]
332 + def test_find_
333 + self.assertRaises(
334 + NodeGroup.
335 + NodeGroupFormFi
336 + factory.
form.clean should really fail with a ValidationError. This will allow the API to dtrt (return a bad request error).
[1]
145 - fields = (
146 - 'hostname',
147 - 'after_
148 - 'architecture',
149 - 'distro_series',
150 + fields = NodeForm.
I'd rather have the field explicitly listed here, much easy to spot a missing field that way.
[2]
242 + <p>
243 + <label for="id_
244 + {{ node_form.nodegroup }}
245 + </p>
You can test this by adding a test similar to testFormContain
- 1025. By Jeroen T. Vermeulen on 2012-09-21
-
Merge trunk.
- 1026. By Jeroen T. Vermeulen on 2012-09-21
-
Review changes.
| Jeroen T. Vermeulen (jtv) wrote : | # |
Thanks for the review, gentlemen. I made the requested changes, except for two (after talking them over with Raphaël):
- The fields change would be non-functional and thus a bit misleading in maintenance. Instead I documented the real meaning of Meta.fields, i.e. to say which fields the form should auto-generate from the model.
- As originally envisioned, the javascript test turned out to be pointless because it only ends up testing the test's own HTML fixtures. It wouldn't be impossible to change, but not particularly cost-effective.
Jeroen


I think the only missing test is to check that the field is not present when the node already exists.
Otherwise this looks good to me, but maybe we want someone with a stronger Django background to also give it a look.