Commit f373cd95 authored by Jelte Jansen's avatar Jelte Jansen
Browse files

replaced workaround (identifier/value switch) by more fundamental solution...

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
parent 8b07c253
......@@ -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")
......
......@@ -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)
......
......@@ -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")
......
......@@ -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()
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment