BIND 10 master, updated. 6600a2c2981b2c37ab42c325e905d4a70a415342 [master] update changelog for merge of #1172
BIND 10 source code commits
bind10-changes at lists.isc.org
Mon Mar 26 09:33:34 UTC 2012
The branch, master has been updated
via 6600a2c2981b2c37ab42c325e905d4a70a415342 (commit)
via bec26c6137c9b0a59a3a8ca0f55a17cfcb8a23de (commit)
via fda8ee0de5fc6416661134a261fb1a5a1569f93e (commit)
via f6c1593309be9e02485a90788f02194ffe036d1c (commit)
via 874cd35c928b9d2d0f53011a5d51fc92a8e9b95c (commit)
from 91071d03e1192378c50012f9e820674d891ed4af (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 6600a2c2981b2c37ab42c325e905d4a70a415342
Author: Jelte Jansen <jelte at isc.org>
Date: Mon Mar 26 11:33:13 2012 +0200
[master] update changelog for merge of #1172
commit bec26c6137c9b0a59a3a8ca0f55a17cfcb8a23de
Merge: 91071d03e1192378c50012f9e820674d891ed4af fda8ee0de5fc6416661134a261fb1a5a1569f93e
Author: Jelte Jansen <jelte at isc.org>
Date: Mon Mar 26 10:44:21 2012 +0200
[master] Merge branch 'trac1172'
-----------------------------------------------------------------------
Summary of changes:
ChangeLog | 6 +++
src/bin/bindctl/bindcmd.py | 14 ++++---
src/bin/bindctl/moduleinfo.py | 39 ++++++++------------
src/bin/bindctl/tests/bindctl_test.py | 3 +-
src/lib/python/isc/config/config_data.py | 19 ++++++----
.../python/isc/config/tests/config_data_test.py | 1 +
6 files changed, 42 insertions(+), 40 deletions(-)
-----------------------------------------------------------------------
diff --git a/ChangeLog b/ChangeLog
index e71b8a4..3097b64 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+409. [bug] jelte
+ Fixed a parser bug in bindctl that could make bindctl crash. Also
+ improved 'command help' output; argument order is now shown
+ correctly, and parameter descriptions are shown as well.
+ (Trac #1172, git bec26c6137c9b0a59a3a8ca0f55a17cfcb8a23de)
+
408. [bug] stephen, jinmei
b10-auth now filters out duplicate RRsets when building a
response message using the new query handling logic. It's
diff --git a/src/bin/bindctl/bindcmd.py b/src/bin/bindctl/bindcmd.py
index b67bc4b..0271c9c 100644
--- a/src/bin/bindctl/bindcmd.py
+++ b/src/bin/bindctl/bindcmd.py
@@ -319,6 +319,8 @@ class BindCmdInterpreter(Cmd):
param_spec = arg)
if ("item_default" in arg):
param.default = arg["item_default"]
+ if ("item_description" in arg):
+ param.desc = arg["item_description"]
cmd.add_param(param)
module.add_command(cmd)
self.add_module_info(module)
@@ -361,12 +363,12 @@ class BindCmdInterpreter(Cmd):
if type(name) == int:
# lump all extraneous arguments together as one big final one
# todo: check if last param type is a string?
- if (param_count > 2):
- while (param_count > len(command_info.params) - 1):
- params[param_count - 2] += params[param_count - 1]
- del(params[param_count - 1])
- param_count = len(params)
- cmd.params = params.copy()
+ while (param_count > 2 and
+ param_count > len(command_info.params) - 1):
+ params[param_count - 2] += " " + params[param_count - 1]
+ del(params[param_count - 1])
+ param_count = len(params)
+ cmd.params = params.copy()
# (-1, help is always in the all_params list)
if name >= len(all_params) - 1:
diff --git a/src/bin/bindctl/moduleinfo.py b/src/bin/bindctl/moduleinfo.py
index 6e41dce..6c3a304 100644
--- a/src/bin/bindctl/moduleinfo.py
+++ b/src/bin/bindctl/moduleinfo.py
@@ -57,8 +57,12 @@ class ParamInfo:
def __str__(self):
return str("\t%s <type: %s> \t(%s)" % (self.name, self.type, self.desc))
- def get_name(self):
- return "%s <type: %s>" % (self.name, self.type)
+ def get_basic_info(self):
+ if self.is_optional:
+ opt_str = "optional"
+ else:
+ opt_str = "mandatory"
+ return "%s (%s, %s)" % (self.name, self.type, opt_str)
def get_desc(self):
return self.desc
@@ -155,37 +159,24 @@ class CommandInfo:
"""Prints the help info for this command to stdout"""
print("Command ", self)
print("\t\thelp (Get help for command)")
-
+
params = self.params.copy()
del params["help"]
if len(params) == 0:
- print("No parameters for the command")
+ print("This command has no parameters")
return
-
- print("\nMandatory parameters:")
- mandatory_infos = []
- for info in params.values():
- if not info.is_optional:
- print(" %s" % info.get_name())
- print(textwrap.fill(info.get_desc(),
- initial_indent=" ",
- subsequent_indent=" ",
- width=70))
- mandatory_infos.append(info)
- optional_infos = [info for info in params.values()
- if info not in mandatory_infos]
- if len(optional_infos) > 0:
- print("\nOptional parameters:")
- for info in optional_infos:
- print(" %s" % info.get_name())
- print(textwrap.fill(info.get_desc(),
+ print("Parameters:")
+ for info in params.values():
+ print(" %s" % info.get_basic_info())
+ description = info.get_desc()
+ if description != "":
+ print(textwrap.fill(description,
initial_indent=" ",
subsequent_indent=" ",
width=70))
-
class ModuleInfo:
"""Define the information of one module, include module name,
module supporting commands.
diff --git a/src/bin/bindctl/tests/bindctl_test.py b/src/bin/bindctl/tests/bindctl_test.py
index cef35dc..31a6bda 100644
--- a/src/bin/bindctl/tests/bindctl_test.py
+++ b/src/bin/bindctl/tests/bindctl_test.py
@@ -180,12 +180,10 @@ class TestCmdSyntax(unittest.TestCase):
self.my_assert_raise(isc.cc.data.DataTypeError, "zone set zone_name ='cn', port='cn'")
self.no_assert_raise("zone reload_all")
-
def testCmdUnknownModuleSyntaxError(self):
self.my_assert_raise(CmdUnknownModuleSyntaxError, "zoned d")
self.my_assert_raise(CmdUnknownModuleSyntaxError, "dd dd ")
-
def testCmdUnknownCmdSyntaxError(self):
self.my_assert_raise(CmdUnknownCmdSyntaxError, "zone dd")
@@ -198,6 +196,7 @@ class TestCmdSyntax(unittest.TestCase):
def testCmdUnknownParamSyntaxError(self):
self.my_assert_raise(CmdUnknownParamSyntaxError, "zone load zone_d='cn'")
self.my_assert_raise(CmdUnknownParamSyntaxError, "zone reload_all zone_name = 'cn'")
+ self.my_assert_raise(CmdUnknownParamSyntaxError, "zone help a b c")
class TestModuleInfo(unittest.TestCase):
diff --git a/src/lib/python/isc/config/config_data.py b/src/lib/python/isc/config/config_data.py
index f8da086..e7e810b 100644
--- a/src/lib/python/isc/config/config_data.py
+++ b/src/lib/python/isc/config/config_data.py
@@ -109,14 +109,17 @@ def convert_type(spec_part, value):
return ret
elif data_type == "map":
- map = ast.literal_eval(value)
- if type(map) == dict:
- # todo: check types of map contents too
- return map
- else:
- raise isc.cc.data.DataTypeError(
- "Value in convert_type not a string "
- "specifying a dict")
+ try:
+ map = ast.literal_eval(value)
+ if type(map) == dict:
+ # todo: check types of map contents too
+ return map
+ else:
+ raise isc.cc.data.DataTypeError(
+ "Value in convert_type not a string "
+ "specifying a dict")
+ except SyntaxError as se:
+ raise isc.cc.data.DataTypeError("Error parsing map: " + str(se))
else:
return value
except ValueError as err:
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 3638f05..446d898 100644
--- a/src/lib/python/isc/config/tests/config_data_test.py
+++ b/src/lib/python/isc/config/tests/config_data_test.py
@@ -157,6 +157,7 @@ class TestConfigData(unittest.TestCase):
self.assertRaises(isc.cc.data.DataTypeError, convert_type, spec_part, [ "a", "b" ])
self.assertRaises(isc.cc.data.DataTypeError, convert_type, spec_part, [ "1", "b" ])
self.assertRaises(isc.cc.data.DataTypeError, convert_type, spec_part, { "a": 1 })
+ self.assertRaises(isc.cc.data.DataTypeError, convert_type, spec_part, "\"{ \"a\": 1 }\"")
spec_part = find_spec_part(config_spec, "value7")
self.assertEqual(['1', '2'], convert_type(spec_part, '1, 2'))
More information about the bind10-changes
mailing list