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:
@@ -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:
|
||||
|
@@ -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):
|
||||
|
||||
|
Reference in New Issue
Block a user