Browse Source

Add instance name to the message of command "Boss shutdown"

git-svn-id: svn://bind10.isc.org/svn/bind10/branches/f2f200910@248 e5f2f494-b856-4b98-b285-d166d9295462
Likun Zhang 15 years ago
parent
commit
ce747fe7b9
2 changed files with 23 additions and 16 deletions
  1. 2 0
      src/bin/bigtool/run_bigtool.py
  2. 21 16
      src/lib/bigtool/bigtool.py

+ 2 - 0
src/bin/bigtool/run_bigtool.py

@@ -18,8 +18,10 @@ def _prepare_fake_data(bigtool):
     zone_module.add_command(remove_cmd)
     zone_module.add_command(list_cmd)
 
+    shutdown_param = ParamInfo(name = "module_name", desc = "the name of module")
     shutdown_cmd = CommandInfo(name = 'shutdown', desc = "stop bind10",
                                need_inst_param = False)
+    shutdown_cmd.add_param(shutdown_param)
     boss_module = ModuleInfo(name = "boss", desc = "boss of bind10")
     boss_module.add_command(shutdown_cmd)               
 

+ 21 - 16
src/lib/bigtool/bigtool.py

@@ -219,26 +219,31 @@ class BigTool(Cmd):
         else:
             self.modules[cmd.module].command_help(cmd.command)
 
-            
+
     def apply_cmd(self, cmd):
         if not self.cc:
             return
         
-        groupName = (cmd.module == "boss") and "Boss" or "ConfigManager"
-        try:
-           content = [cmd.module, cmd.command]
-           values = cmd.params.values()
-           if len(values) > 0:
-               content.append(list(values)[0])
-
-           msg = {"command":content}
-           print("begin to send the message...")
-           
-           self.cc.group_sendmsg(msg, groupName)
-           print("waiting for %s reply..." % groupName)
-
-           reply, env = self.cc.group_recvmsg(False)
-           print("received reply:", reply)
+        instance = '*'
+        content = [cmd.module, cmd.command]
+        groupName = 'ConfigManager'
+        values = cmd.params.values()
+        if cmd.module == 'boss':
+            groupName = "Boss"
+            instance = list(values)[0]
+        else:
+            if len(values) > 0:
+                content.append(list(values)[0])
+
+        msg = {"command":content}
+        print("begin to send the message...")
+        
+        try:   
+            self.cc.group_sendmsg(msg, groupName, instance)
+            print("waiting for %s reply..." % groupName)
+
+            reply, env = self.cc.group_recvmsg(False)
+            print("received reply:", reply)
         except:
             print("Error communication with %s" % groupName)