Merge lp:~racb/maas/subarch-model into lp:maas/trunk
| Status: | Merged |
|---|---|
| Approved by: | Jeroen T. Vermeulen on 2012-09-28 |
| Approved revision: | 1109 |
| Merged at revision: | 1105 |
| Proposed branch: | lp:~racb/maas/subarch-model |
| Merge into: | lp:maas/trunk |
| Diff against target: |
735 lines (+503/-49) 11 files modified
src/maasserver/api.py (+26/-3) src/maasserver/enum.py (+6/-6) src/maasserver/messages.py (+1/-1) src/maasserver/migrations/0031_node_architecture_field_size.py (+190/-0) src/maasserver/migrations/0032_node_subarch.py (+191/-0) src/maasserver/models/node.py (+1/-1) src/maasserver/preseed.py (+1/-0) src/maasserver/tests/test_api.py (+70/-6) src/maasserver/tests/test_node.py (+1/-1) src/maasserver/tests/test_node_constraint_filter.py (+8/-6) src/maasserver/tests/test_preseed.py (+8/-25) |
| To merge this branch: | bzr merge lp:~racb/maas/subarch-model |
| Related bugs: |
| Reviewer | Review Type | Date Requested | Status |
|---|---|---|---|
| Gavin Panella (community) | 2012-09-27 | Approve on 2012-09-28 | |
|
Review via email:
|
|||
Commit Message
Add subarchitecture support to the Node model
This also requires an addition to the enlistment API. A new field "subarchitecture", if specified, specifies the subarchitecture of the machine being enlisted. The corresponding change in maas-enlist is tracked in bug 1056816.
| Martin Packman (gz) wrote : | # |
- 1099. By Robie Basak on 2012-09-27
-
Fix enlistment API test
This broke when I removed /generic to make i386 and amd64 friendly names
friendly.
| Gavin Panella (allenap) wrote : | # |
Looks good! A few comments, but they're all very minor.
[1]
+ architecture = factory.
+ filter(lambda choice: choice[
+ ARCHITECTURE_
On the whole we try to avoid filter and map, because comprehensions
are normally much easier to read, and because their behaviour changes
in Python 3. I think the above would clearer as:
architecture = factory.
[choice for choice in ARCHITECTURE_
if choice[
[2]
+ parsed_result = json.loads(
+
+ self.assertEqu
+ self.assertIn(
Don't parse the result until after the response has been checked; it
might fail and then we know less about the failure. How about:
self.assertEqual(
(httplib.OK, 'application/
(response.
response.content)
parsed_result = json.loads(
If the response is not OK or the content-type is not JSON, this will
blow up with the mismatch and the response content as detail.
[3]
+ self.assertIn(
There's assertStartsWith too, if you just want to check that it's
text/plain.
[4]
+ self.assertEqu
Sentences end in a full-stop... unless the convention elsewhere in the
codebase to not do that. Very minor point, but it makes a difference
to the overall polish.
[5]
+ self.assertEqu
+ self.assertEqu
Failures would be more informative if this were done in a single
assertion:
observed_arch = params_out["arch"], params_
self.assertEqu
[6]
node_template_name = "%s_%s_%s_%s" % (
- prefix, node.architecture, release, node.hostname)
+ prefix, node.architectu
+ release, node.hostname)
Because the components are delimited by _, perhaps replace / in the
architecture with - or : instead?
- 1100. By Robie Basak on 2012-09-28
-
Replace filter with list comprehension
- 1101. By Robie Basak on 2012-09-28
-
Check response code before checking response
- 1102. By Robie Basak on 2012-09-28
-
Check just for text/plain to match the other tests
- 1103. By Robie Basak on 2012-09-28
-
End error sentence with a full stop.
- 1104. By Robie Basak on 2012-09-28
-
Test arch and subarch in a single assertion
| Robie Basak (racb) wrote : | # |
Thanks for the review, Gavin!
[1] Done
[2] This was the pattern followed before, but as I've touched every test that followed this pattern I've changed them all to check the response status. This should cause a test failure to be more useful to understand.
[3] assertIn is the pattern followed in all the existing tests, and this change only touches some of them. So I've kept this the same to stay consistent. I have dropped the "charset=utf-8" part though, as I don't think this is really what I'm testing.
[4] Done
[5] Done
[6] node_template_name must follow the template filename layout defined in src/maasserver/
| Raphaël Badin (rvb) wrote : | # |
Wait, migrations number 29 and 30 have been taken already. You need to recreate your migrations. That's because the entire state of the db is present in each transaction file.
You need to
- delete your migrations
- merge trunk
- regenerate your migrations, they should be numbered 31 and 32.
- 1105. By Robie Basak on 2012-09-28
-
Remove migrations as they've been superceded
- 1106. By Robie Basak on 2012-09-28
-
Merge trunk
- 1107. By Robie Basak on 2012-09-28
-
Add recreated migrations
- 1108. By Robie Basak on 2012-09-28
-
Fix constraint tests that broke in trunk merge
- 1109. By Robie Basak on 2012-09-28
-
Merge trunk


Temporarily making constraints specify the full form "i386/generic" rather than just "i386" is fine. A follow up branch can do the fix we talked about that maps the main architecture strings to the set of all supported sub-architectures.