[svn] commit: r2657 - in /trunk: ./ src/bin/bindctl/ src/bin/bindctl/tests/ src/bin/xfrin/ src/lib/cc/ src/lib/datasrc/ src/lib/dns/ src/lib/dns/rdata/generic/ src/lib/dns/tests/ src/lib/python/isc/config/ src/lib/python/isc/config/tests/

BIND 10 source code commits bind10-changes at lists.isc.org
Mon Aug 9 07:36:47 UTC 2010


Author: jelte
Date: Mon Aug  9 07:36:47 2010
New Revision: 2657

Log:
merged trac ticket #99

Modified:
    trunk/   (props changed)
    trunk/ChangeLog
    trunk/src/bin/bindctl/bindcmd.py
    trunk/src/bin/bindctl/tests/bindctl_test.py
    trunk/src/bin/xfrin/   (props changed)
    trunk/src/lib/cc/   (props changed)
    trunk/src/lib/datasrc/   (props changed)
    trunk/src/lib/dns/   (props changed)
    trunk/src/lib/dns/rdata/generic/rrsig_46.cc   (props changed)
    trunk/src/lib/dns/tests/   (props changed)
    trunk/src/lib/python/isc/config/config_data.py
    trunk/src/lib/python/isc/config/tests/config_data_test.py

Modified: trunk/ChangeLog
==============================================================================
--- trunk/ChangeLog (original)
+++ trunk/ChangeLog Mon Aug  9 07:36:47 2010
@@ -1,3 +1,10 @@
+  80.	[bug]		jelte
+	bindctl no longer accepts configuration changes for unknown or
+	non-running modules (for the latter, this is until we have a
+	way to verify those options, at which point it'll be allowed
+	again).
+	(Trac #99)
+
   79.	[func]		feng, jinmei
 	Refactored the ASIO link interfaces to move incoming XFR and
 	NOTIFY processing to the auth server class.  Wrapper classes for

Modified: trunk/src/bin/bindctl/bindcmd.py
==============================================================================
--- trunk/src/bin/bindctl/bindcmd.py (original)
+++ trunk/src/bin/bindctl/bindcmd.py Mon Aug  9 07:36:47 2010
@@ -543,6 +543,16 @@
                     identifier = cmd.params['identifier']
                 else:
                     identifier += cmd.params['identifier']
+
+                # Check if the module is known; for unknown modules
+                # we currently deny setting preferences, as we have
+                # no way yet to determine if they are ok.
+                module_name = identifier.split('/')[1]
+                if self.config_data is None or \
+                   not self.config_data.have_specification(module_name):
+                    print("Error: Module '" + module_name + "' unknown or not running")
+                    return
+
             if cmd.command == "show":
                 values = self.config_data.get_value_maps(identifier)
                 for value_map in values:

Modified: trunk/src/bin/bindctl/tests/bindctl_test.py
==============================================================================
--- trunk/src/bin/bindctl/tests/bindctl_test.py (original)
+++ trunk/src/bin/bindctl/tests/bindctl_test.py Mon Aug  9 07:36:47 2010
@@ -237,6 +237,11 @@
             assert self.random_names[i] == cmd_names[i+1]
             assert self.random_names[i] == module_names[i+1]
             i = i + 1
+
+    def test_apply_cfg_command(self):
+        self.tool.location = '/'
+        cmd = cmdparse.BindCmdParse("config set identifier=\"foo/bar\" value=\"5\"")
+        self.tool.apply_config_cmd(cmd)
     
 class FakeBindCmdInterpreter(bindcmd.BindCmdInterpreter):
     def __init__(self):

Modified: trunk/src/lib/python/isc/config/config_data.py
==============================================================================
--- trunk/src/lib/python/isc/config/config_data.py (original)
+++ trunk/src/lib/python/isc/config/config_data.py Mon Aug  9 07:36:47 2010
@@ -250,6 +250,11 @@
         """Removes the specification with the given module name. Does nothing if it wasn't there."""
         if module_name in self._specifications:
             del self._specifications[module_name]
+
+    def have_specification(self, module_name):
+        """Returns True if we have a specification for the module with the given name.
+           Returns False if we do not."""
+        return module_name in self._specifications
 
     def get_module_spec(self, module):
         """Returns the ModuleSpec for the module with the given name.

Modified: trunk/src/lib/python/isc/config/tests/config_data_test.py
==============================================================================
--- trunk/src/lib/python/isc/config/tests/config_data_test.py (original)
+++ trunk/src/lib/python/isc/config/tests/config_data_test.py Mon Aug  9 07:36:47 2010
@@ -267,12 +267,16 @@
         self.assertEqual({}, self.mcd._current_config)
         self.assertEqual({}, self.mcd._local_changes)
 
-    def test_set_specification(self):
+    def test_set_remove_specification(self):
         module_spec = isc.config.module_spec_from_file(self.data_path + os.sep + "spec1.spec")
-        self.mcd.set_specification(module_spec)
+        self.assertFalse(self.mcd.have_specification(module_spec.get_module_name()))
+        self.mcd.set_specification(module_spec)
+        self.assertTrue(self.mcd.have_specification(module_spec.get_module_name()))
         self.assert_(module_spec.get_module_name() in self.mcd._specifications)
         self.assertEquals(module_spec, self.mcd._specifications[module_spec.get_module_name()])
         self.assertRaises(ConfigDataError, self.mcd.set_specification, "asdf")
+        self.mcd.remove_specification(module_spec.get_module_name())
+        self.assertFalse(self.mcd.have_specification(module_spec.get_module_name()))
 
     def test_get_module_spec(self):
         module_spec = isc.config.module_spec_from_file(self.data_path + os.sep + "spec1.spec")




More information about the bind10-changes mailing list