Browse Source

replaced workaround (identifier/value switch) by more fundamental solution (making the value optional)

git-svn-id: svn://bind10.isc.org/svn/bind10/branches/trac405@3723 e5f2f494-b856-4b98-b285-d166d9295462
Jelte Jansen 14 years ago
parent
commit
f373cd95de

+ 4 - 1
src/bin/bindctl/bindcmd.py

@@ -569,7 +569,10 @@ class BindCmdInterpreter(Cmd):
             elif cmd.command == "add":
                 self.config_data.add_value(identifier, cmd.params['value'])
             elif cmd.command == "remove":
-                self.config_data.remove_value(identifier, cmd.params['value'])
+                if 'value' in cmd.params:
+                    self.config_data.remove_value(identifier, cmd.params['value'])
+                else:
+                    self.config_data.remove_value(identifier, None)
             elif cmd.command == "set":
                 if 'identifier' not in cmd.params:
                     print("Error: missing identifier or value")

+ 1 - 1
src/bin/bindctl/bindctl-source.py.in

@@ -48,7 +48,7 @@ def prepare_config_commands(tool):
     cmd = CommandInfo(name = "remove", desc = "Remove entry from configuration list")
     param = ParamInfo(name = "identifier", type = "string", optional=True)
     cmd.add_param(param)
-    param = ParamInfo(name = "value", type = "string", optional=False)
+    param = ParamInfo(name = "value", type = "string", optional=True)
     cmd.add_param(param)
     module.add_command(cmd)
 

+ 0 - 3
src/lib/python/isc/config/ccsession.py

@@ -395,9 +395,6 @@ class UIModuleCCSession(MultiConfigData):
            a DataTypeError if the value at the identifier is not a list,
            or if the given value_str does not match the list_item_spec
            """
-        if identifier == "":
-            identifier = value_str
-            value_str = None
         module_spec = self.find_spec_part(identifier)
         if (type(module_spec) != dict or "list_item_spec" not in module_spec):
             raise isc.cc.data.DataNotFoundError(str(identifier) + " is not a list")

+ 0 - 2
src/lib/python/isc/config/tests/ccsession_test.py

@@ -639,8 +639,6 @@ class TestUIModuleCCSession(unittest.TestCase):
         self.assertEqual({'Spec2': {'item5': ['foo']}}, uccs._local_changes)
         uccs.remove_value("Spec2/item5[0]", None)
         self.assertEqual({'Spec2': {'item5': []}}, uccs._local_changes)
-        uccs.remove_value("", "Spec2/item5[0]")
-        self.assertEqual({'Spec2': {'item5': []}}, uccs._local_changes)
 
     def test_commit(self):
         fake_conn = fakeUIConn()