Merge lp:~rvb/maas/bug-1065406 into lp:maas/trunk
Proposed by
Raphaël Badin
on 2012-10-11
| Status: | Merged | ||||
|---|---|---|---|---|---|
| Approved by: | Raphaël Badin on 2012-10-11 | ||||
| Approved revision: | 1259 | ||||
| Merged at revision: | 1257 | ||||
| Proposed branch: | lp:~rvb/maas/bug-1065406 | ||||
| Merge into: | lp:maas/trunk | ||||
| Diff against target: |
105 lines (+51/-0) 4 files modified
src/maasserver/dhcp.py (+4/-0) src/maasserver/models/nodegroup.py (+13/-0) src/maasserver/tests/test_dhcp.py (+10/-0) src/maasserver/tests/test_nodegroup.py (+24/-0) |
||||
| To merge this branch: | bzr merge lp:~rvb/maas/bug-1065406 | ||||
| Related bugs: |
|
| Reviewer | Review Type | Date Requested | Status |
|---|---|---|---|
| Jeroen T. Vermeulen (community) | 2012-10-11 | Approve on 2012-10-11 | |
|
Review via email:
|
|||
Commit Message
Generate a dhcp key (if nodegroup,dhcp_key is empty) before we write the dhcp_config.
Description of the Change
Make sure we have a valid dhcp_key before we write the dhcp_config.
= Pre-imp =
Discussed with Jeroen.
= Notes =
The trick in ensure_dhcp_key is a bit messy but I see no other way to do this: ensure_dhcp_key is called from configure_dhcp which is hooked-up to NodeGroup.post_save so it cannot trigger a pose_save signal itself.
To post a comment you must log in.
| Jeroen T. Vermeulen (jtv) wrote : | # |
| Jeroen T. Vermeulen (jtv) wrote : | # |
Hmmm that was meant to be an Approve. Thought I'd clicked that.
review:
Approve
lp:~rvb/maas/bug-1065406
updated
on 2012-10-11
- 1259. By Raphaël Badin on 2012-10-11
-
Fix docstring.
| Raphaël Badin (rvb) wrote : | # |
Thanks for the review.
I've updated the docstring of ensure_dhcp_key.


Good stuff. Just this:
3 + def ensure_ dhcp_key( self): post_save/ etc)."" "
24 + """If self.dhcp_key is empty: create a valid dhcp key.
25 +
26 + This method persists the dhcp key without triggering the model
27 + signals (pre_save/
Not just create: set it on the nodegroup. Maybe "ensure that this nodegroup has a dhcp key"?
28 + if self.dhcp_key == '': omapi_key( ) objects. filter( id=self. id).update( dhcp_key= dhcp_key)
29 + dhcp_key = generate_
30 + self.dhcp_key = dhcp_key
31 + # Persist the dhcp_key without triggering the signals.
32 + NodeGroup.
Don't forget to say why it's important that the signal doesn't fire!