Can't clear model fields
Bug #1259872 reported by
Jeroen T. Vermeulen
This bug affects 1 person
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
MAAS |
Won't Fix
|
High
|
Unassigned |
Bug Description
In the database schema, a node's zone is a foreign key to the Zone table. It's not the Zone's surrogate key though, but its name. Or it may be null, of course.
We have no obvious way to clear a node's zone. In the API, the empty string is accepted as a zone, but it doesn't actually update the field. The UI offers a default “---------” choice, but it doesn't affect the field either. And passing None in the API results in an "invalid choice" error.
Related branches
lp:~allenap/maas/clear-field-via-api--bug-1259872
- Graham Binns (community): Approve
- Jeroen T. Vermeulen (community): Approve
-
Diff: 191 lines (+52/-48)3 files modifiedsrc/maasserver/api.py (+6/-19)
src/maasserver/forms.py (+43/-27)
src/maasserver/tests/test_forms.py (+3/-2)
description: | updated |
description: | updated |
Changed in maas: | |
status: | Confirmed → Triaged |
status: | Triaged → In Progress |
assignee: | nobody → Gavin Panella (allenap) |
Changed in maas: | |
status: | In Progress → Triaged |
assignee: | Gavin Panella (allenap) → nobody |
summary: |
- Can't clear a node's availabillity zone + Can't clear model fields |
Changed in maas: | |
status: | Triaged → Won't Fix |
To post a comment you must log in.
The trick is that we need to get the form to be able to distinguish between: None as in "set the zone to None" and None as in "this value was not provided". I have the feeling we need to use the sentinel pattern here but it's not clear at which level (form validation, model persistence, etc) it should be done.