Merge lp:~jtv/maas/bug-1116700 into lp:~maas-committers/maas/trunk
Status: | Merged |
---|---|
Approved by: | Jeroen T. Vermeulen |
Approved revision: | no longer in the source branch. |
Merged at revision: | 1430 |
Proposed branch: | lp:~jtv/maas/bug-1116700 |
Merge into: | lp:~maas-committers/maas/trunk |
Diff against target: |
111 lines (+43/-32) 2 files modified
src/maasserver/models/dhcplease.py (+24/-24) src/maasserver/tests/test_dhcplease.py (+19/-8) |
To merge this branch: | bzr merge lp:~jtv/maas/bug-1116700 |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Raphaël Badin (community) | Approve | ||
Review via email: mp+146835@code.launchpad.net |
Commit message
Generate CNAME for a node's oldest MACAddress that has a lease. (We used to generate a CNAME for a node's oldest MACAddress *if it had* a lease).
We don't know why the code was originally written this way, although it was deliberate at the time (originally proposed at https:/
Description of the change
We're taking a bit of a risk with this one, because we've lost the reason for the original behaviour. We do know that we had to do things like this for the original Cobbler-based MAAS, where things worked the way they did simply because that's how they worked in Cobbler, or because it was the way we ended up interfacing with Cobbler. DHCPLease was bolted on later, so there may have been problems with incorporating it nicely.
Raphaël sees no problem with the change. It seems more sensible than what we did before.
Looks good to me.
Thanks for updating the test's name and adding a new test.
3 tiny notes:
[0]
50 + node.hostname, lease.ip, mac.id
[...]
59 - for hostname, ip in cursor.fetchall()
60 + for hostname, ip, mac in cursor.fetchall()
You probably don't need to return the 'mac' in the query since you're ignoring it later.
[1]
101 + lease_for_newer_mac = factory. make_dhcp_ lease( node.nodegroup, mac=newer_ mac.mac_ address) unused( lease_for_ newer_mac)
102 + nodegroup=
103 + ignore_
A bit far fetched :) I'd get rid of the assignment and the ignore_unused() statement because I think the name of the other variable 'lease_ for_older_ mac' make the whole design pretty clear.
[2]
69 -# Copyright 2012 Canonical Ltd. This software is licensed under the
70 +# Copyright 2013 Canonical Ltd. This software is licensed under the
That's a nice touch but now you got me wondering about why you did not update dhcplease.py's header ;).