2
0
mirror of https://gitlab.isc.org/isc-projects/kea synced 2025-08-31 14:05:33 +00:00

[1172] fix the cmd parser list index problem

make the initial if>2 part of the while
also add a space when glueing extraneous arguments together
This commit is contained in:
Jelte Jansen
2012-03-22 15:17:28 +01:00
parent f6c1593309
commit fda8ee0de5
2 changed files with 7 additions and 8 deletions

View File

@@ -363,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:

View File

@@ -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):