[svn] commit: r2996 - in /branches/trac343/src: bin/bindctl/bindcmd.py lib/python/isc/cc/data.py lib/python/isc/config/config_data.py
BIND 10 source code commits
bind10-changes at lists.isc.org
Tue Sep 21 09:26:44 UTC 2010
Author: zhanglikun
Date: Tue Sep 21 09:26:44 2010
New Revision: 2996
Log:
Make config command works well if user haven't run config go command.
Modified:
branches/trac343/src/bin/bindctl/bindcmd.py
branches/trac343/src/lib/python/isc/cc/data.py
branches/trac343/src/lib/python/isc/config/config_data.py
Modified: branches/trac343/src/bin/bindctl/bindcmd.py
==============================================================================
--- branches/trac343/src/bin/bindctl/bindcmd.py (original)
+++ branches/trac343/src/bin/bindctl/bindcmd.py Tue Sep 21 09:26:44 2010
@@ -53,6 +53,7 @@
CSV_FILE_NAME = 'default_user.csv'
FAIL_TO_CONNECT_WITH_CMDCTL = "Fail to connect with b10-cmdctl module, is it running?"
CONFIG_MODULE_NAME = 'config'
+DEFAULT_LOCATION = ''
CONST_BINDCTL_HELP = """
usage: <module name> <command name> [param1 = value1 [, param2 = value2]]
Type Tab character to get the hint of module/command/parameters.
@@ -90,7 +91,7 @@
def __init__(self, server_port = 'localhost:8080', pem_file = None):
Cmd.__init__(self)
- self.location = ""
+ self.location = DEFAULT_LOCATION
self.prompt_end = '> '
self.prompt = self.prompt_end
self.ruler = '-'
@@ -345,11 +346,9 @@
elif not name in all_params:
raise CmdUnknownParamSyntaxError(cmd.module, cmd.command, name)
- param_nr = 0
for name in manda_params:
- if not name in params and not param_nr in params:
+ if not name in cmd.params:
raise CmdMissParamSyntaxError(cmd.module, cmd.command, name)
- param_nr += 1
# Convert parameter value according parameter spec file.
# Ignore check for commands belongs to module 'config'
@@ -550,6 +549,9 @@
not self.config_data.have_specification(module_name):
print("Error: Module '" + module_name + "' unknown or not running")
return
+ elif identifier == DEFAULT_LOCATION:
+ print("Error: Please set proper identifier for config command")
+ return
if cmd.command == "show":
values = self.config_data.get_value_maps(identifier)
@@ -594,7 +596,7 @@
except isc.cc.data.DataTypeError as dte:
print("Error: " + str(dte))
except isc.cc.data.DataNotFoundError as dnfe:
- print("Error: " + identifier + " not found")
+ print("Error: " + str(dnfe))
except KeyError as ke:
print("Error: missing " + str(ke))
raise ke
Modified: branches/trac343/src/lib/python/isc/cc/data.py
==============================================================================
--- branches/trac343/src/lib/python/isc/cc/data.py (original)
+++ branches/trac343/src/lib/python/isc/cc/data.py Tue Sep 21 09:26:44 2010
@@ -68,7 +68,7 @@
if type(cur_el) == dict and id in cur_el.keys():
cur_el = cur_el[id]
else:
- raise DataNotFoundError(identifier + " in " + str(element))
+ raise DataNotFoundError(identifier + " in " + str(element) + ' not found')
return cur_el
def set(element, identifier, value):
Modified: branches/trac343/src/lib/python/isc/config/config_data.py
==============================================================================
--- branches/trac343/src/lib/python/isc/config/config_data.py (original)
+++ branches/trac343/src/lib/python/isc/config/config_data.py Tue Sep 21 09:26:44 2010
@@ -116,7 +116,7 @@
cur_el = cur_el_item
found = True
if not found:
- raise isc.cc.data.DataNotFoundError(id + " in " + str(cur_el))
+ raise isc.cc.data.DataNotFoundError(id + " in " + str(cur_el) + ' not found')
elif type(cur_el) == list:
found = False
for cur_el_item in cur_el:
@@ -124,7 +124,7 @@
cur_el = cur_el_item
found = True
if not found:
- raise isc.cc.data.DataNotFoundError(id + " in " + str(cur_el))
+ raise isc.cc.data.DataNotFoundError(id + " in " + str(cur_el) + ' not found')
else:
raise isc.cc.data.DataNotFoundError("Not a correct config specification")
return cur_el
More information about the bind10-changes
mailing list