Browse Source

[2136] Removed 'trees' argument from 'getstats' command

Naoki Kambe 13 years ago
parent
commit
be7020b546
2 changed files with 5 additions and 17 deletions
  1. 3 4
      src/bin/stats/stats.py.in
  2. 2 13
      src/bin/stats/tests/test_utils.py

+ 3 - 4
src/bin/stats/stats.py.in

@@ -174,9 +174,8 @@ class Stats:
     def do_polling(self):
     def do_polling(self):
         """Polls modules for statistics data. Return nothing. First
         """Polls modules for statistics data. Return nothing. First
            search multiple instances of same module. Second requests
            search multiple instances of same module. Second requests
-           each module to invoke 'getstats' with a 'trees' argument.
-           Finally updates internal statistics data every time it gets
-           from each instance."""
+           each module to invoke 'getstats'. Finally updates internal
+           statistics data every time it gets from each instance."""
 
 
         # count the number of instances of same module by examing
         # count the number of instances of same module by examing
         # 'components' of Boss via ConfigManager
         # 'components' of Boss via ConfigManager
@@ -200,7 +199,7 @@ class Stats:
             logger.debug(DBG_STATS_MESSAGING, STATS_SEND_STATISTICS_REQUEST,
             logger.debug(DBG_STATS_MESSAGING, STATS_SEND_STATISTICS_REQUEST,
                          module_name)
                          module_name)
             cmd = isc.config.ccsession.create_command(
             cmd = isc.config.ccsession.create_command(
-                "getstats", {'trees': [k for k in data.keys()]})
+                "getstats", None) # no argument
             seq = self.cc_session.group_sendmsg(cmd, module_name)
             seq = self.cc_session.group_sendmsg(cmd, module_name)
             sequences.append((module_name, seq))
             sequences.append((module_name, seq))
             cnt = modules.count(module_name)
             cnt = modules.count(module_name)

+ 2 - 13
src/bin/stats/tests/test_utils.py

@@ -273,15 +273,8 @@ class MockBoss:
         self._started.set()
         self._started.set()
         self.got_command_name = command
         self.got_command_name = command
         sdata = self.statistics_data
         sdata = self.statistics_data
-        params = { "owner": "Boss",
-                   "data": sdata
-                   }
         if command == 'getstats':
         if command == 'getstats':
-            notfound = [ t for t in args[0]['trees'] if t not in sdata ]
-            if notfound:
-                return isc.config.create_answer(1, notfound)
-            return isc.config.create_answer(
-                0, dict([(t,sdata[t]) for t in args[0]['trees'] if t in sdata ]))
+            return isc.config.create_answer(0, self.statistics_data)
         elif command == 'show_processes':
         elif command == 'show_processes':
             # Return dummy pids
             # Return dummy pids
             return isc.config.create_answer(
             return isc.config.create_answer(
@@ -410,11 +403,7 @@ class MockAuth:
                        'queries.udp': self.queries_udp,
                        'queries.udp': self.queries_udp,
                        'queries.perzone' : self.queries_per_zone }
                        'queries.perzone' : self.queries_per_zone }
         if command == 'getstats':
         if command == 'getstats':
-            notfound = [ t for t in args[0]['trees'] if t not in sdata ]
-            if notfound:
-                return isc.config.create_answer(1, notfound)
-            return isc.config.create_answer(
-                0, dict([(t,sdata[t]) for t in args[0]['trees'] if t in sdata ]))
+            return isc.config.create_answer(0, sdata)
         return isc.config.create_answer(1, "Unknown Command")
         return isc.config.create_answer(1, "Unknown Command")
 
 
 class MyStats(stats.Stats):
 class MyStats(stats.Stats):