Commit ed9e6e6a authored by Jelte Jansen's avatar Jelte Jansen
Browse files

fix handling of shutdown messages


git-svn-id: svn://bind10.isc.org/svn/bind10/branches/parkinglot@301 e5f2f494-b856-4b98-b285-d166d9295462
parent ebecf5b1
......@@ -154,7 +154,8 @@ class BoB:
def stop_all_processes(self):
"""Stop all processes."""
cmd = { "command": "shutdown" }
self.cc_session.group_sendmsg(cmd, "Boss", "*")
self.cc_session.group_sendmsg(cmd, "Boss", "ConfigManager")
self.cc_session.group_sendmsg(cmd, "Boss", "ParkingLot")
def stop_process(self, process):
"""Stop the given process, friendly-like."""
......
......@@ -41,7 +41,7 @@ CommandSession::CommandSession() :
try {
session_.establish();
session_.subscribe("ParkingLot", "*");
session_.subscribe("Boss", "*", "meonly");
session_.subscribe("Boss", "ParkingLot");
session_.subscribe("ConfigManager", "*", "meonly");
session_.subscribe("statistics", "*", "meonly");
} catch (...) {
......@@ -83,6 +83,12 @@ CommandSession::getCommand(int counter) {
if (cmd != NULL) {
return std::pair<string, string>("delzone", cmd->string_value());
}
cmd = data->get("command");
if (cmd != NULL) {
if (cmd->get_type() == Element::string && cmd->string_value() == "shutdown") {
return std::pair<string, string>("shutdown", "");
}
}
}
return std::pair<string, string>("unknown", "");
......
......@@ -74,7 +74,7 @@ class ConfigManager:
answer["result"] = [ 1, "Unknown zone" ]
elif cmd[0] == "zone" and cmd[1] == "list":
answer["result"] = list(self.config.zones.keys())
elif len(cmd) > 1 and cmd[1] == "shutdown":
elif cmd == "shutdown":
print("Received shutdown command")
self.running = False
else:
......
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