Merge lp://staging/~julian-edwards/maas/forwarders-config-writer into lp://staging/~maas-committers/maas/trunk
Status: | Merged |
---|---|
Approved by: | Julian Edwards |
Approved revision: | no longer in the source branch. |
Merged at revision: | 2001 |
Proposed branch: | lp://staging/~julian-edwards/maas/forwarders-config-writer |
Merge into: | lp://staging/~maas-committers/maas/trunk |
Diff against target: |
297 lines (+258/-0) 5 files modified
buildout.cfg (+1/-0) src/maasserver/management/commands/edit_named_options.py (+124/-0) src/maasserver/tests/test_commands_edit_named_options.py (+129/-0) src/provisioningserver/dns/config.py (+1/-0) versions.cfg (+3/-0) |
To merge this branch: | bzr merge lp://staging/~julian-edwards/maas/forwarders-config-writer |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Jeroen T. Vermeulen (community) | Approve | ||
Review via email:
|
Commit message
Add a command utility that amends the named.conf.options file so that it includes the maas forwarders config. Intended to be called from packaging when installing maas.
Description of the change
This branch adds a helper for the packaging so that the named.conf.options file can be edited to include the maas forwarders config.
It introduces a new dependency called iscpy, which can parse and edit ISC-style config files, like the ones that named uses. Sadly it's not packaged so I am going to have to get roaksoax on the case :)
When it runs it goes to great lengths to make sure nothing bad is going to happen. There's a bunch of checks that everything parsed OK, and additionally it tries to make a backup of the existing file. The backup file name has got a timestamp in it, so this can be re-run for ever with no losses incurred. If the backup fails, no changes get made in the original file.
I spent a lot of time making the tests nice and readable. I hope you appreciate it!
Glad you got this to work. There's always a certain comfort about having a third party worry about a problem like this.
Hang on.
Hang on...
Question: are we not writing docstrings anymore? That's fine, whatever. But if we're doing a new thing, nobody told me.
.
In parse_file, given the agoraphobiagenic broadness of the exceptions, could you at least report, in one way or another, the original exception message as raised by iscpy?
.
In set_up_ include_ statement, I have a vague memory of there being a reason why neither os.path.join nor posixpath.join was appropriate here... worth a comment maybe?
.
I see no mention of what it means if you already had a ‘forwarders’ setting. And yet we overwrite it. Worth saying?
.
Why the vague implicit-bool-based test “options_ block.get( 'forwarders' , None)” in remove_forwarders? Are you saying that if there's an empty string rather than None, it should not be removed? Would "'forwarders' in options_block" not produce the right answer?
.
In back_up_ existing_ file, could you print/log the original exception message as raised from iscpy?
.
Moving on to the tests, test_exits_ when_no_ file_to_ edit relies on there being no file called 'foo'. I think it would make more sense to do this in a temporary directory.
.
In test_exits_ when_fails_ to_make_ backup, is Mock not more convenient than defining a function? Also, isn't the realistic thing to do to raise an IOError object, rather than the IOError class?
.
In test_normal_ operation, would glob() be an easier way to get the backup file?