Commit ab5085e8 authored by Naoki Kambe's avatar Naoki Kambe
Browse files

[trac929] add "get_statistics_spec" into cfgmgr.py

it pushes contents in statistics category of each spec file.
parent 5e621bce
......@@ -267,6 +267,19 @@ class ConfigManager:
commands[module_name] = self.module_specs[module_name].get_commands_spec()
return commands
def get_statistics_spec(self, name = None):
"""Returns a dict containing 'module_name': statistics_spec for
all modules. If name is specified, only that module will
be included"""
statistics = {}
if name:
if name in self.module_specs:
statistics[name] = self.module_specs[name].get_statistics_spec()
else:
for module_name in self.module_specs.keys():
statistics[module_name] = self.module_specs[module_name].get_statistics_spec()
return statistics
def read_config(self):
"""Read the current configuration from the file specificied at init()"""
try:
......@@ -457,6 +470,8 @@ class ConfigManager:
if cmd:
if cmd == ccsession.COMMAND_GET_COMMANDS_SPEC:
answer = ccsession.create_answer(0, self.get_commands_spec())
elif cmd == ccsession.COMMAND_GET_STATISTICS_SPEC:
answer = ccsession.create_answer(0, self.get_statistics_spec())
elif cmd == ccsession.COMMAND_GET_MODULE_SPEC:
answer = self._handle_get_module_spec(arg)
elif cmd == ccsession.COMMAND_GET_CONFIG:
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment