[roster-dns-management] r1164 committed - Fixing bug in tree_exporter that would put "masterfile-format raw" out...

0 views
Skip to first unread message

roster-dns...@googlecode.com

unread,
Aug 14, 2013, 4:43:39 PM8/14/13
to roster-...@googlegroups.com
Revision: 1164
Author: J.S.P...@gmail.com
Date: Wed Aug 14 13:43:31 2013
Log: Fixing bug in tree_exporter that would put "masterfile-format
raw" outside of options{} if no named conf global options were provided
http://code.google.com/p/roster-dns-management/source/detail?r=1164

Modified:
/trunk/roster-config-manager/roster_config_manager/tree_exporter.py
/trunk/test/tree_exporter_test.py

=======================================
--- /trunk/roster-config-manager/roster_config_manager/tree_exporter.py Fri
Jul 19 13:56:34 2013
+++ /trunk/roster-config-manager/roster_config_manager/tree_exporter.py Wed
Aug 14 13:43:31 2013
@@ -430,6 +430,10 @@
if( newest_config is not None ):
deserialized_config = iscpy.Deserialize(newest_config)
if( binary ):
+ if( len(deserialized_config) == 0 ):
+ return (u'options {\n'
+ u'masterfile-format raw;\n'
+ u'};')
deserialized_part = deserialized_config.partition('options {')
new_options = '\nmasterfile-format raw; '
deserialized_config = '%s%s%s%s' % (
=======================================
--- /trunk/test/tree_exporter_test.py Wed Aug 14 13:03:51 2013
+++ /trunk/test/tree_exporter_test.py Wed Aug 14 13:43:31 2013
@@ -284,6 +284,84 @@
self.assertRaises(tree_exporter.Error,
self.tree_exporter_instance.ExportAllBindTrees)

+ def testBinaryNamedConfWithNoOptions(self):
+ named_conf_global_options_dict = self.db_instance.GetEmptyRowDict(
+ 'named_conf_global_options')
+ named_conf_global_options_dict[
+ 'named_conf_global_options_dns_server_set_name'] = u'internal_dns'
+ self.db_instance.StartTransaction()
+ try:
+ named_conf_global_options_dict =
self.db_instance.ListRow('named_conf_global_options',
+ named_conf_global_options_dict)[0]
+ self.db_instance.RemoveRow('named_conf_global_options',
+ named_conf_global_options_dict)
+ finally:
+ self.db_instance.EndTransaction()
+
+ self.core_instance.MakeNamedConfGlobalOption(u'internal_dns', u'')
+ self.tree_exporter_instance.ExportAllBindTrees()
+ self.config_lib_instance.UnTarDnsTree()
+
+ with open((os.path.join(
+ self.root_config_dir, u'dns1.university.edu',
u'named.conf.b')), 'r') as \
+ binary_named_conf_handle:
+ binary_named_conf = binary_named_conf_handle.read()
+
+ self.assertEqual(binary_named_conf,
+ '#This named.conf file is autogenerated. DO NOT EDIT\n'
+ 'options {
directory "/home/jpavlick/Roster/sethbug4.0/tree/trunk/test/test_data/bind_dir/named";\n'
+ 'masterfile-format raw; };\n'
+ 'acl secret {\n'
+ '\t10.10/32;\n'
+ '};\n'
+ '\n'
+ 'acl public {\n'
+ '\t192.168.1.4/30;\n'
+ '\t10.10/32;\n'
+ '};\n'
+ '\n'
+ 'view "external" {\n'
+ '\tmatch-clients { \n'
+ '\t\tpublic;\n'
+ '\t };\n'
+ '\trecursion no;\n'
+ '\tzone "." {\n'
+ '\t\ttype hint;\n'
+ '\t\tfile "named.ca";\n'
+ '\t};\n'
+ '\tzone "university.edu" {\n'
+ '\t\ttype master;\n'
+ '\t\tfile "external/university.edu.aa";\n'
+ '\t\tallow-update { none; };\n'
+ '\t};\n'
+ '\tzone "4.3.2.in-addr.arpa" {\n'
+ '\t\ttype master;\n'
+ '\t\tfile "external/4.3.2.in-addr.aa";\n'
+ '\t\tallow-update { none; };\n'
+ '\t};\n'
+ '};\n'
+ 'view "internal" {\n'
+ '\tmatch-clients { \n'
+ '\t\t!public;\n'
+ '\t\tsecret;\n'
+ '\t };\n'
+ '\trecursion no;\n'
+ '\tzone "." {\n'
+ '\t\ttype hint;\n'
+ '\t\tfile "named.ca";\n'
+ '\t};\n'
+ '\tzone "university.edu" {\n'
+ '\t\ttype master;\n'
+ '\t\tfile "internal/university.edu.aa";\n'
+ '\t\tallow-update { none; };\n'
+ '\t};\n'
+ '\tzone "168.192.in-addr.arpa" {\n'
+ '\t\ttype master;\n'
+ '\t\tfile "internal/168.192.in-addr.aa";\n'
+ '\t\tallow-update { none; };\n'
+ '\t};\n'
+ '};')
+
def testTreeExporterMakeNamedConf(self):
self.core_instance.SetMaintenanceFlag(1)
self.assertRaises(tree_exporter.MaintenanceError,
Reply all
Reply to author
Forward
0 new messages