BIND 10 trac2254, updated. ae8740e0bf3dc8daf25323d442ef5ba135817caa [2254] Merge branch 'trac2254' of ssh://git.bind10.isc.org/var/bind10/git/bind10 into trac2254
BIND 10 source code commits
bind10-changes at lists.isc.org
Tue Oct 2 13:45:12 UTC 2012
The branch, trac2254 has been updated
via ae8740e0bf3dc8daf25323d442ef5ba135817caa (commit)
via ed5f58850ca6c58778ec3241968ada3bbca67096 (commit)
via 397769f9a994bdf1a2716ee89d6746769c11c13d (commit)
from 7a0a89d0cab063bb69e4ec4fede497f9d8d329ba (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit ae8740e0bf3dc8daf25323d442ef5ba135817caa
Merge: ed5f588 7a0a89d
Author: Jelte Jansen <jelte at isc.org>
Date: Tue Oct 2 15:44:50 2012 +0200
[2254] Merge branch 'trac2254' of ssh://git.bind10.isc.org/var/bind10/git/bind10 into trac2254
commit ed5f58850ca6c58778ec3241968ada3bbca67096
Author: Jelte Jansen <jelte at isc.org>
Date: Tue Oct 2 15:41:01 2012 +0200
[2254] one more comment
commit 397769f9a994bdf1a2716ee89d6746769c11c13d
Author: Jelte Jansen <jelte at isc.org>
Date: Tue Oct 2 15:30:22 2012 +0200
[2254] Expand _complete comment, add one more testcase
also renamed IDENTIFIER_PARAM to CFGITEM_IDENTIFIER_PARAM
-----------------------------------------------------------------------
Summary of changes:
src/bin/bindctl/bindcmd.py | 22 ++++++++++++---
src/bin/bindctl/bindctl_main.py.in | 28 ++++++++++----------
src/bin/bindctl/tests/bindctl_test.py | 2 +-
.../tests/testdata/{spec24.spec => spec42.spec} | 5 ++--
src/lib/python/isc/config/config_data.py | 3 ---
.../python/isc/config/tests/config_data_test.py | 8 ++++++
6 files changed, 43 insertions(+), 25 deletions(-)
copy src/lib/config/tests/testdata/{spec24.spec => spec42.spec} (82%)
-----------------------------------------------------------------------
diff --git a/src/bin/bindctl/bindcmd.py b/src/bin/bindctl/bindcmd.py
index 8b17695..b4e71bf 100644
--- a/src/bin/bindctl/bindcmd.py
+++ b/src/bin/bindctl/bindcmd.py
@@ -61,7 +61,7 @@ except ImportError:
# Used for tab-completion of 'identifiers' (i.e. config values)
# If a command parameter has this name, the tab completion hints
# are derived from config data
-IDENTIFIER_PARAM = 'identifier'
+CFGITEM_IDENTIFIER_PARAM = 'identifier'
CSV_FILE_NAME = 'default_user.csv'
CONFIG_MODULE_NAME = 'config'
@@ -495,7 +495,7 @@ class BindCmdInterpreter(Cmd):
if cmd.module not in self.modules:
return False
command = self.modules[cmd.module].get_command_with_name(cmd.command)
- return command.has_param_with_name(IDENTIFIER_PARAM)
+ return command.has_param_with_name(CFGITEM_IDENTIFIER_PARAM)
def complete(self, text, state):
"""
@@ -538,8 +538,22 @@ class BindCmdInterpreter(Cmd):
if not cmd.params and text:
hints = self._get_command_startswith(cmd.module, text)
elif self._cmd_has_identifier_param(cmd):
- # For tab-completion of identifiers, replace hardcoded
- # hints with hints derived from the config data
+ # If the command has an argument that is a configuration
+ # identifier (currently, this is only a subset of
+ # the config commands), then don't tab-complete with
+ # hints derived from command parameters, but from
+ # possible configuration identifiers.
+ #
+ # This solves the issue reported in #2254, where
+ # there were hints such as 'argument' and 'identifier'.
+ #
+ # Since they are replaced, the tab-completion no longer
+ # adds 'help' as an option (but it still works)
+ #
+ # Also, currently, tab-completion does not work
+ # together with 'config go' (it does not take 'current
+ # position' into account). But config go currently has
+ # problems by itself, unrelated to completion.
hints = self._get_identifier_startswith(text)
else:
hints = self._get_param_startswith(cmd.module, cmd.command,
diff --git a/src/bin/bindctl/bindctl_main.py.in b/src/bin/bindctl/bindctl_main.py.in
index 1f86ec9..546ecc0 100755
--- a/src/bin/bindctl/bindctl_main.py.in
+++ b/src/bin/bindctl/bindctl_main.py.in
@@ -42,15 +42,15 @@ def prepare_config_commands(tool):
cmd = CommandInfo(name = "show", desc = "Show configuration.")
param = ParamInfo(name = "argument", type = "string", optional=True, desc = "If you specify the argument 'all' (before the identifier), recursively show all child elements for the given identifier.")
cmd.add_param(param)
- param = ParamInfo(name=IDENTIFIER_PARAM, type="string", optional=True,
- desc=DEFAULT_IDENTIFIER_DESC)
+ param = ParamInfo(name=CFGITEM_IDENTIFIER_PARAM, type="string",
+ optional=True, desc=DEFAULT_IDENTIFIER_DESC)
cmd.add_param(param)
module.add_command(cmd)
cmd = CommandInfo(name="show_json",
desc="Show full configuration in JSON format.")
- param = ParamInfo(name=IDENTIFIER_PARAM, type="string", optional=True,
- desc=DEFAULT_IDENTIFIER_DESC)
+ param = ParamInfo(name=CFGITEM_IDENTIFIER_PARAM, type="string",
+ optional=True, desc=DEFAULT_IDENTIFIER_DESC)
cmd.add_param(param)
module.add_command(cmd)
@@ -63,8 +63,8 @@ def prepare_config_commands(tool):
"parameter value, similar to when adding to a list. "
"In either case, when no value is given, an entry will be "
"constructed with default values.")
- param = ParamInfo(name=IDENTIFIER_PARAM, type="string", optional=True,
- desc=DEFAULT_IDENTIFIER_DESC)
+ param = ParamInfo(name=CFGITEM_IDENTIFIER_PARAM, type="string",
+ optional=True, desc=DEFAULT_IDENTIFIER_DESC)
cmd.add_param(param)
param = ParamInfo(name="value_or_name", type="string", optional=True,
desc="Specifies a value to add to the list, or the name when adding to a named set. It must be in correct JSON format and complete.")
@@ -76,16 +76,16 @@ def prepare_config_commands(tool):
module.add_command(cmd)
cmd = CommandInfo(name="remove", desc="Remove entry from configuration list or named set.")
- param = ParamInfo(name=IDENTIFIER_PARAM, type="string", optional=True,
- desc=DEFAULT_IDENTIFIER_DESC)
+ param = ParamInfo(name=CFGITEM_IDENTIFIER_PARAM, type="string",
+ optional=True, desc=DEFAULT_IDENTIFIER_DESC)
cmd.add_param(param)
param = ParamInfo(name = "value", type = "string", optional=True, desc = "When identifier is a list, specifies a value to remove from the list. It must be in correct JSON format and complete. When it is a named set, specifies the name to remove.")
cmd.add_param(param)
module.add_command(cmd)
cmd = CommandInfo(name="set", desc="Set a configuration value.")
- param = ParamInfo(name=IDENTIFIER_PARAM, type="string", optional=True,
- desc=DEFAULT_IDENTIFIER_DESC)
+ param = ParamInfo(name=CFGITEM_IDENTIFIER_PARAM, type="string",
+ optional=True, desc=DEFAULT_IDENTIFIER_DESC)
cmd.add_param(param)
param = ParamInfo(name="value", type="string", optional=False,
desc="Specifies a value to set. It must be in correct JSON format and complete.")
@@ -93,8 +93,8 @@ def prepare_config_commands(tool):
module.add_command(cmd)
cmd = CommandInfo(name="unset", desc="Unset a configuration value (i.e. revert to the default, if any).")
- param = ParamInfo(name=IDENTIFIER_PARAM, type="string", optional=False,
- desc=DEFAULT_IDENTIFIER_DESC)
+ param = ParamInfo(name=CFGITEM_IDENTIFIER_PARAM, type="string",
+ optional=False, desc=DEFAULT_IDENTIFIER_DESC)
cmd.add_param(param)
module.add_command(cmd)
@@ -108,8 +108,8 @@ def prepare_config_commands(tool):
module.add_command(cmd)
cmd = CommandInfo(name="go", desc="Go to a specific configuration part.")
- param = ParamInfo(name=IDENTIFIER_PARAM, type="string", optional=False,
- desc=DEFAULT_IDENTIFIER_DESC)
+ param = ParamInfo(name=CFGITEM_IDENTIFIER_PARAM, type="string",
+ optional=False, desc=DEFAULT_IDENTIFIER_DESC)
cmd.add_param(param)
module.add_command(cmd)
diff --git a/src/bin/bindctl/tests/bindctl_test.py b/src/bin/bindctl/tests/bindctl_test.py
index 8d6b668..f598472 100644
--- a/src/bin/bindctl/tests/bindctl_test.py
+++ b/src/bin/bindctl/tests/bindctl_test.py
@@ -456,7 +456,7 @@ class TestConfigCommands(unittest.TestCase):
module = ModuleInfo(name="test_module")
cmd = CommandInfo(name="command_with_identifier")
- param = ParamInfo(name=bindcmd.IDENTIFIER_PARAM)
+ param = ParamInfo(name=bindcmd.CFGITEM_IDENTIFIER_PARAM)
cmd.add_param(param)
module.add_command(cmd)
diff --git a/src/lib/config/tests/testdata/spec42.spec b/src/lib/config/tests/testdata/spec42.spec
new file mode 100644
index 0000000..d822465
--- /dev/null
+++ b/src/lib/config/tests/testdata/spec42.spec
@@ -0,0 +1,17 @@
+{
+ "module_spec": {
+ "module_name": "Spec42",
+ "config_data": [
+ { "item_name": "list_item",
+ "item_type": "list",
+ "item_optional": true,
+ "list_item_spec": {
+ "item_name": "list_element",
+ "item_type": "string",
+ "item_optional": false,
+ "item_default": ""
+ }
+ }
+ ]
+ }
+}
diff --git a/src/lib/python/isc/config/config_data.py b/src/lib/python/isc/config/config_data.py
index 7fde0ea..ae61e2a 100644
--- a/src/lib/python/isc/config/config_data.py
+++ b/src/lib/python/isc/config/config_data.py
@@ -841,9 +841,6 @@ class MultiConfigData:
_get_list_items("Module/list")
where the list contains 2 elements, returns
[ "Module/list[0]", "Module/list[1]" ]
- _get_list_items("Module/list")
- where the list contains 2 elements, returns
- [ "Module/list[0]", "Module/list[1]" ]
"""
spec_part = self.find_spec_part(item_name)
if spec_part_is_named_set(spec_part):
diff --git a/src/lib/python/isc/config/tests/config_data_test.py b/src/lib/python/isc/config/tests/config_data_test.py
index e8a77af..45feb35 100644
--- a/src/lib/python/isc/config/tests/config_data_test.py
+++ b/src/lib/python/isc/config/tests/config_data_test.py
@@ -798,6 +798,14 @@ class TestMultiConfigData(unittest.TestCase):
'Spec2/item4', 'Spec2/item5', 'Spec2/item6/value1',
'Spec2/item6/value2'], config_items)
+ # Also if the list is None (optional value and no default)
+ module_spec = isc.config.module_spec_from_file(self.data_path
+ + os.sep
+ + "spec42.spec")
+ self.mcd.set_specification(module_spec)
+ config_items = self.mcd.get_config_item_list("Spec42", True)
+ self.assertEqual(['Spec42/list_item'], config_items)
+
def test_is_named_set(self):
module_spec = isc.config.module_spec_from_file(self.data_path + os.sep + "spec32.spec")
self.mcd.set_specification(module_spec)
More information about the bind10-changes
mailing list