2
0
mirror of https://gitlab.isc.org/isc-projects/kea synced 2025-09-01 14:35:29 +00:00

don't send config if it is None

removed catch-all in ccsession (i want to get the original exception)
check result size after get_config in parkinglot


git-svn-id: svn://bind10.isc.org/svn/bind10/branches/jelte-datadef@397 e5f2f494-b856-4b98-b285-d166d9295462
This commit is contained in:
Jelte Jansen
2009-12-22 09:38:48 +00:00
parent 91d64d64b9
commit ec10fee3bd
3 changed files with 33 additions and 31 deletions

View File

@@ -82,7 +82,6 @@ CommandSession::CommandSession(std::string module_name,
config_handler_ = config_handler;
command_handler_ = command_handler;
try {
// todo: workaround, let boss wait until msgq is started
// and remove sleep here
sleep(1);
@@ -107,15 +106,14 @@ CommandSession::CommandSession(std::string module_name,
session_.group_recvmsg(env, answer, false);
cout << "[XX] got config: " << endl << answer->str() << endl;
// replace string_value and "0" with int_value and 0 with new cc after merge */
if (answer->contains("result") && answer->get("result")->get(0)->string_value() == "0") {
if (answer->contains("result") &&
answer->get("result")->get(0)->string_value() == "0" &&
answer->get("result")->size() > 1) {
config_handler(answer->get("result")->get(1));
} else {
cout << "[XX] no result in answer" << endl;
}
}
} catch (...) {
throw std::runtime_error("SessionManager: failed to open sessions");
}
}
int

View File

@@ -108,7 +108,10 @@ class ConfigManager:
pass
else:
conf_part = self.config.data
if conf_part:
answer["result"] = [ 0, conf_part ]
else:
answer["result"] = [ 0 ]
elif cmd[0] == "set_config":
if len(cmd) == 3:
# todo: use api (and check types?)
@@ -162,7 +165,6 @@ class ConfigManager:
if "config_data" in spec:
self.set_config(spec["module_name"], spec["config_data"])
self.cc.group_sendmsg({ "specification_update": [ spec["module_name"], spec["config_data"] ] }, "BigTool")
print("[XX] sent spec_update")
if "commands" in spec:
self.set_commands(spec["module_name"], spec["commands"])
self.cc.group_sendmsg({ "commands_update": [ spec["module_name"], spec["commands"] ] }, "BigTool")

View File

@@ -99,6 +99,7 @@ namespace ISC { namespace Data {
virtual void set(const int i, ElementPtr element) { throw TypeError(); };
virtual void add(ElementPtr element) { throw TypeError(); };
virtual void remove(ElementPtr element) { throw TypeError(); };
virtual size_t size() { throw TypeError(); };
// for maps
virtual ElementPtr get(const std::string& name) { throw TypeError(); } ;
@@ -236,6 +237,7 @@ namespace ISC { namespace Data {
std::string str();
std::string str_xml(size_t prefix = 0);
std::string to_wire(int omit_length = 1);
size_t size() { return l.size(); }
};
class MapElement : public Element {