Commit 126e683f authored by Francis Dupont's avatar Francis Dupont
Browse files

[master] Updated control socket toElement (post-merge)

parent 6951d7b4
......@@ -1659,11 +1659,9 @@ const char* EXTRACTED_CONFIGS[] = {
" }\n"
" ],\n"
" \"control-socket\": {\n"
" \"comment\": \"Indirect comment\",\n"
" \"socket-name\": \"/tmp/kea4-ctrl-socket\",\n"
" \"socket-type\": \"unix\",\n"
" \"user-context\": {\n"
" \"comment\": \"Indirect comment\"\n"
" }\n"
" \"socket-type\": \"unix\"\n"
" },\n"
" \"dhcp-ddns\": {\n"
" \"comment\": \"No dynamic DNS\",\n"
......@@ -6404,11 +6402,9 @@ const char* UNPARSED_CONFIGS[] = {
" }\n"
" ],\n"
" \"control-socket\": {\n"
" \"comment\": \"Indirect comment\",\n"
" \"socket-name\": \"/tmp/kea4-ctrl-socket\",\n"
" \"socket-type\": \"unix\",\n"
" \"user-context\": {\n"
" \"comment\": \"Indirect comment\"\n"
" }\n"
" \"socket-type\": \"unix\"\n"
" },\n"
" \"decline-probation-period\": 86400,\n"
" \"dhcp-ddns\": {\n"
......
......@@ -1529,11 +1529,9 @@ const char* EXTRACTED_CONFIGS[] = {
" }\n"
" ],\n"
" \"control-socket\": {\n"
" \"comment\": \"Indirect comment\",\n"
" \"socket-name\": \"/tmp/kea6-ctrl-socket\",\n"
" \"socket-type\": \"unix\",\n"
" \"user-context\": {\n"
" \"comment\": \"Indirect comment\"\n"
" }\n"
" \"socket-type\": \"unix\"\n"
" },\n"
" \"dhcp-ddns\": {\n"
" \"comment\": \"No dynamic DNS\",\n"
......@@ -6002,11 +6000,9 @@ const char* UNPARSED_CONFIGS[] = {
" }\n"
" ],\n"
" \"control-socket\": {\n"
" \"comment\": \"Indirect comment\",\n"
" \"socket-name\": \"/tmp/kea6-ctrl-socket\",\n"
" \"socket-type\": \"unix\",\n"
" \"user-context\": {\n"
" \"comment\": \"Indirect comment\"\n"
" }\n"
" \"socket-type\": \"unix\"\n"
" },\n"
" \"decline-probation-period\": 86400,\n"
" \"dhcp-ddns\": {\n"
......
......@@ -363,7 +363,23 @@ SrvConfig::toElement() const {
}
// Set control-socket (skip if null as empty is not legal)
if (!isNull(control_socket_)) {
dhcp->set("control-socket", control_socket_);
ElementPtr csocket = isc::data::copy(control_socket_);
ConstElementPtr ctx = csocket->get("user-context");
// Protect against not map
if (ctx && (ctx->getType() != Element::map)) {
ctx.reset();
}
// Extract comment
if (ctx && ctx->contains("comment")) {
ElementPtr ctx_copy = isc::data::copy(ctx);
csocket->set("comment", ctx_copy->get("comment"));
ctx_copy->remove("comment");
csocket->remove("user-context");
if (ctx_copy->size() > 0) {
csocket->set("user-context", ctx_copy);
}
}
dhcp->set("control-socket", csocket);
}
// Set client-classes
ConstElementPtr client_classes = class_dictionary_->toElement();
......
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