Merge lp:~jameinel/maas/tag-list-api into lp:maas/trunk
| Status: | Merged |
|---|---|
| Approved by: | John A Meinel on 2012-09-25 |
| Approved revision: | 1054 |
| Merged at revision: | 1070 |
| Proposed branch: | lp:~jameinel/maas/tag-list-api |
| Merge into: | lp:maas/trunk |
| Diff against target: |
495 lines (+300/-4) 8 files modified
src/maasserver/api.py (+99/-0) src/maasserver/forms.py (+13/-0) src/maasserver/models/node.py (+3/-0) src/maasserver/models/tag.py (+28/-1) src/maasserver/testing/factory.py (+3/-1) src/maasserver/tests/test_api.py (+147/-1) src/maasserver/tests/test_tag.py (+1/-1) src/maasserver/urls_api.py (+6/-0) |
| To merge this branch: | bzr merge lp:~jameinel/maas/tag-list-api |
| Related bugs: |
| Reviewer | Review Type | Date Requested | Status |
|---|---|---|---|
| John A Meinel | Approve on 2012-09-25 | ||
| Jeroen T. Vermeulen (community) | 2012-09-21 | Approve on 2012-09-24 | |
|
Review via email:
|
|||
Commit Message
Expose '/tags/' for CRUD. And expose tags as an attribute of Node.
Description of the Change
This adds 2 primary features
'/tags/' to the api, with the ability to create new tags, and PUT/DELETE to update and remove them.
This also tries to expose tags as an attribute of Node, but it seems to be exposing more than I really want. (I don't need the whole tag definition exposed, just the basic name.)
Note that this doesn't actually apply tags to nodes based on the definition, because we need the lshw in the table for that.
| Jeroen T. Vermeulen (jtv) wrote : | # |
| Jeroen T. Vermeulen (jtv) wrote : | # |
May I recommend factory.make_name() as a nicer way to generate randomized names?
Also, it's a bit pointless to assert that the row count of a query is zero -- just self.assertFals
In the tests where you assert a row count of 1, there are two different concerns: that the count be nonzero, and that there be no more than one row. The latter is probably guarded by a unique-constraint in the database, in which case you might as well use self.assertTrue
self.
-
Then, a small note about this test:
339 + def test_GET_
340 + # The api allows for fetching a single Node (using system_id).
341 + tag = factory.
342 + response = self.client.
343 + parsed_result = json.loads(
344 +
345 + self.assertEqua
346 + self.assertEqua
347 + self.assertEqua
348 + self.assertEqua
Better test the status code _before_ you decode the contents, otherwise an unexpected result will get you a traceback for non-JSON contents before you even get to the status-code check.
| Jeroen T. Vermeulen (jtv) wrote : | # |
As per IRC: I had one big question mark for the "nodes" method being a POST, but that's an infrastructure limitation. Otherwise, once my notes are addressed, I'm quite happy with this branch.
| MAAS Lander (maas-lander) wrote : | # |
There are additional revisions which have not been approved in review. Please seek review and approval of these new revisions.


You left this TODO comment in src/maasserver/ api.py:
89 +# TODO: Add AnonTagsHandler /AnonTagHandler ?
Don't land TODO comments. Some of us use a bzr plugin that warns about such comments as signs that the branch is not ready for review. Resolve it if you can, or if it's serious and has to be deferred, make it an XXX with a bug number.
As for the issue that the comment is about, it seems to me that exposing the tagging of nodes (e.g. the "nodes" operation) reveals inventory information that administrators may want to keep private. These things are often worth their own tests.