BIND 10 trac930, updated. b7a511e6d3067c9b364c337d34b600f88a02d7be [trac930] modify the update_modues function There is no part of statistics category in the spec file of a module which has no statistics data.
BIND 10 source code commits
bind10-changes at lists.isc.org
Wed Jul 27 11:45:29 UTC 2011
The branch, trac930 has been updated
via b7a511e6d3067c9b364c337d34b600f88a02d7be (commit)
via 2166335cf053d66fb5ddae5e3831875ae2eb93ce (commit)
via e1bb6e7a24e10f167c77583a46d5ff69a8a8777b (commit)
from afc497e50cef8491e5df06f5ae3bcd4ec0cbb1a3 (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 b7a511e6d3067c9b364c337d34b600f88a02d7be
Author: Naoki Kambe <kambe at jprs.co.jp>
Date: Wed Jul 27 20:45:18 2011 +0900
[trac930] modify the update_modues function
There is no part of statistics category in the spec file of a module which has
no statistics data.
commit 2166335cf053d66fb5ddae5e3831875ae2eb93ce
Author: Naoki Kambe <kambe at jprs.co.jp>
Date: Wed Jul 27 16:49:21 2011 +0900
[trac930]
- correct error messages in bindctl
it prints together with arguments.
- modify the command_show function
it reports statistics data of the module even if name is not specified.
- add/modify unittests depending on the changes of error messages
commit e1bb6e7a24e10f167c77583a46d5ff69a8a8777b
Author: Naoki Kambe <kambe at jprs.co.jp>
Date: Wed Jul 27 16:42:54 2011 +0900
[trac930] remove unnecessary a white space
-----------------------------------------------------------------------
Summary of changes:
src/bin/stats/stats.py.in | 20 +++++------
src/bin/stats/tests/b10-stats_test.py | 56 ++++++++++++++++++++++++++------
src/bin/stats/tests/test_utils.py | 2 +-
3 files changed, 55 insertions(+), 23 deletions(-)
-----------------------------------------------------------------------
diff --git a/src/bin/stats/stats.py.in b/src/bin/stats/stats.py.in
index 1abe449..0d43570 100644
--- a/src/bin/stats/stats.py.in
+++ b/src/bin/stats/stats.py.in
@@ -208,8 +208,7 @@ class Stats:
(rcode, value) = isc.config.ccsession.parse_answer(answer)
if rcode == 0:
for mod in value:
- spec = { "module_name" : mod,
- "statistics" : [] }
+ spec = { "module_name" : mod }
if value[mod] and type(value[mod]) is list:
spec["statistics"] = value[mod]
modules[mod] = isc.config.module_spec.ModuleSpec(spec)
@@ -259,7 +258,7 @@ class Stats:
self.statistics_data[owner].update(data)
return
except KeyError:
- errors.append('unknown module name')
+ errors.append("unknown module name: " + str(owner))
return errors
def command_status(self):
@@ -289,8 +288,6 @@ class Stats:
else:
logger.debug(DBG_STATS_MESSAGING,
STATS_RECEIVED_SHOW_ALL_COMMAND)
- if owner and not name:
- return isc.config.create_answer(1, "item name is not specified")
errors = self.update_statistics_data(
self.module_name,
timestamp=get_timestamp(),
@@ -298,11 +295,12 @@ class Stats:
)
if errors: raise StatsError("stats spec file is incorrect")
ret = self.get_statistics_data(owner, name)
- if ret:
+ if ret is not None:
return isc.config.create_answer(0, ret)
else:
return isc.config.create_answer(
- 1, "specified module name and/or item name are incorrect")
+ 1, "specified arguments are incorrect: " \
+ + "owner: " + str(owner) + ", name: " + str(name))
def command_showschema(self, owner=None, name=None):
"""
@@ -335,7 +333,8 @@ class Stats:
else:
return isc.config.create_answer(0, schema)
return isc.config.create_answer(
- 1, "specified module name and/or item name are incorrect")
+ 1, "specified arguments are incorrect: " \
+ + "owner: " + str(owner) + ", name: " + str(name))
def command_set(self, owner, data):
"""
@@ -344,9 +343,8 @@ class Stats:
errors = self.update_statistics_data(owner, **data)
if errors:
return isc.config.create_answer(
- 1,
- "specified module name and/or statistics data are incorrect: "
- + ", ".join(errors))
+ 1, "errors while setting statistics data: " \
+ + ", ".join(errors))
errors = self.update_statistics_data(
self.module_name, last_update_time=get_datetime() )
if errors:
diff --git a/src/bin/stats/tests/b10-stats_test.py b/src/bin/stats/tests/b10-stats_test.py
index 6ddd39b..640b796 100644
--- a/src/bin/stats/tests/b10-stats_test.py
+++ b/src/bin/stats/tests/b10-stats_test.py
@@ -331,7 +331,7 @@ class TestStats(unittest.TestCase):
self.assertEqual(self.stats.update_statistics_data(owner='Stats', lname=0.0),
['0.0 should be a string'])
self.assertEqual(self.stats.update_statistics_data(owner='Dummy', foo='bar'),
- ['unknown module name'])
+ ['unknown module name: Dummy'])
def test_command_status(self):
self.assertEqual(self.stats.command_status(),
@@ -346,13 +346,20 @@ class TestStats(unittest.TestCase):
def test_command_show(self):
self.assertEqual(self.stats.command_show(owner='Foo', name=None),
- isc.config.create_answer(1, "item name is not specified"))
+ isc.config.create_answer(
+ 1, "specified arguments are incorrect: owner: Foo, name: None"))
self.assertEqual(self.stats.command_show(owner='Foo', name='_bar_'),
isc.config.create_answer(
- 1, "specified module name and/or item name are incorrect"))
+ 1, "specified arguments are incorrect: owner: Foo, name: _bar_"))
self.assertEqual(self.stats.command_show(owner='Foo', name='bar'),
isc.config.create_answer(
- 1, "specified module name and/or item name are incorrect"))
+ 1, "specified arguments are incorrect: owner: Foo, name: bar"))
+ self.assertEqual(self.stats.command_show(owner='Auth'),
+ isc.config.create_answer(
+ 0, {'queries.tcp': 0, 'queries.udp': 0}))
+ self.assertEqual(self.stats.command_show(owner='Auth', name='queries.udp'),
+ isc.config.create_answer(
+ 0, 0))
orig_get_timestamp = stats.get_timestamp
orig_get_datetime = stats.get_datetime
stats.get_timestamp = lambda : 1308730448.965706
@@ -452,13 +459,42 @@ class TestStats(unittest.TestCase):
self.assertEqual(self.stats.command_showschema(owner='Foo'),
isc.config.create_answer(
- 1, "specified module name and/or item name are incorrect"))
+ 1, "specified arguments are incorrect: owner: Foo, name: None"))
self.assertEqual(self.stats.command_showschema(owner='Foo', name='bar'),
isc.config.create_answer(
- 1, "specified module name and/or item name are incorrect"))
+ 1, "specified arguments are incorrect: owner: Foo, name: bar"))
+ self.assertEqual(self.stats.command_showschema(owner='Auth'),
+ isc.config.create_answer(
+ 0, [{
+ "item_default": 0,
+ "item_description": "A number of total query counts which all auth servers receive over TCP since they started initially",
+ "item_name": "queries.tcp",
+ "item_optional": False,
+ "item_title": "Queries TCP",
+ "item_type": "integer"
+ },
+ {
+ "item_default": 0,
+ "item_description": "A number of total query counts which all auth servers receive over UDP since they started initially",
+ "item_name": "queries.udp",
+ "item_optional": False,
+ "item_title": "Queries UDP",
+ "item_type": "integer"
+ }]))
+ self.assertEqual(self.stats.command_showschema(owner='Auth', name='queries.tcp'),
+ isc.config.create_answer(
+ 0, {
+ "item_default": 0,
+ "item_description": "A number of total query counts which all auth servers receive over TCP since they started initially",
+ "item_name": "queries.tcp",
+ "item_optional": False,
+ "item_title": "Queries TCP",
+ "item_type": "integer"
+ }))
+
self.assertEqual(self.stats.command_showschema(owner='Stats', name='bar'),
isc.config.create_answer(
- 1, "specified module name and/or item name are incorrect"))
+ 1, "specified arguments are incorrect: owner: Stats, name: bar"))
self.assertEqual(self.stats.command_showschema(name='bar'),
isc.config.create_answer(
1, "module name is not specified"))
@@ -487,8 +523,7 @@ class TestStats(unittest.TestCase):
data={ 'lname' : '_foo_ at _bar_' }),
isc.config.create_answer(
1,
- "specified module name and/or statistics data are incorrect:"
- + " unknown item lname"))
+ "errors while setting statistics data: unknown item lname"))
self.stats.statistics_data['Stats'] = {}
self.stats.mccs.specification = isc.config.module_spec.ModuleSpec(
{ "module_name": self.stats.module_name } )
@@ -496,8 +531,7 @@ class TestStats(unittest.TestCase):
data={ 'lname' : '_foo_ at _bar_' }),
isc.config.create_answer(
1,
- "specified module name and/or statistics data are incorrect:"
- + " No statistics specification"))
+ "errors while setting statistics data: No statistics specification"))
self.stats.statistics_data['Stats'] = {}
self.stats.mccs.specification = isc.config.module_spec.ModuleSpec(
{ "module_name": self.stats.module_name,
diff --git a/src/bin/stats/tests/test_utils.py b/src/bin/stats/tests/test_utils.py
index cfffc15..b3e20b5 100644
--- a/src/bin/stats/tests/test_utils.py
+++ b/src/bin/stats/tests/test_utils.py
@@ -182,7 +182,7 @@ class MockAuth:
"item_type": "integer",
"item_optional": false,
"item_default": 0,
- "item_title": "Queries TCP ",
+ "item_title": "Queries TCP",
"item_description": "A number of total query counts which all auth servers receive over TCP since they started initially"
},
{
More information about the bind10-changes
mailing list