Merge lp:~jtv/maas/dns-zones-explicit-data-flow into lp:~maas-committers/maas/trunk
Status: | Merged |
---|---|
Approved by: | Jeroen T. Vermeulen |
Approved revision: | no longer in the source branch. |
Merged at revision: | 1843 |
Proposed branch: | lp:~jtv/maas/dns-zones-explicit-data-flow |
Merge into: | lp:~maas-committers/maas/trunk |
Prerequisite: | lp:~jtv/maas/delegate-write_config |
Diff against target: |
366 lines (+86/-90) 3 files modified
src/maasserver/tests/test_dns.py (+3/-3) src/provisioningserver/dns/config.py (+70/-54) src/provisioningserver/dns/tests/test_config.py (+13/-33) |
To merge this branch: | bzr merge lp:~jtv/maas/dns-zones-explicit-data-flow |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Raphaël Badin (community) | Approve | ||
Review via email: mp+202620@code.launchpad.net |
This proposal supersedes a proposal from 2014-01-22.
Commit message
Make data-passing in the DNS zone config classes more explicit.
Description of the change
This completes my refactoring of the DNS config module. It makes private some instance variables that are not effectively part of the classes' interfaces. Helper methods become class methods and receive their inputs as parameters, so that hopefully it'll be easier to assess the impact of future changes. It also makes them a bit easier to test, but that's just a happy coincidence. The main thing is improving our ability to understand and change the code.
A new method make_parameters does the common part of what the two get_context methods did. The remainder of what those methods did is now inlined into the write_config methods.
Jeroen
[0]
82 - def get_cname_ mapping( self): mapping( cls, mapping):
83 + @classmethod
84 + def get_cname_
85 """Return a generator with the mapping: hostname->generated hostname.
86
87 The mapping only contains hosts for which the two host names differ.
98 - def get_static_ mapping( self): mapping( cls, domain, networks, dns_ip):
99 + @classmethod
100 + def get_static_
101 """Return a generator with the mapping fqdn->ip for the generated ips.
Both these methods have been turned into class-level utilities, it might be worth updating their docstrings to describe the parameters.