Commit ce747fe7 authored by Likun Zhang's avatar Likun Zhang
Browse files

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
parent e258d1b6
......@@ -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)
......
......@@ -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)
......
Supports Markdown
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