self hosted controller JSON format fix for DNS

This commit is contained in:
Grant Limberg 2020-09-23 12:16:10 -07:00
parent 7d8cfb1fee
commit ff23d3051f
No known key found for this signature in database
GPG Key ID: 2BA62CCABBB4095A

View File

@ -1031,25 +1031,21 @@ unsigned int EmbeddedNetworkController::handleControlPlaneHttpPOST(
if (b.count("dns")) {
json &dns = b["dns"];
if (dns.is_array()) {
json nda = json::array();
for(unsigned int i=0;i<dns.size();++i) {
json &d = dns[i];
if (d.is_object()) {
json nd = json::object();
nd["domain"] = d["domain"];
json &srv = d["servers"];
if (srv.is_array()) {
json ns = json::array();
for(unsigned int j=0;j<srv.size();++j) {
ns.push_back(srv[i]);
}
nd["servers"] = ns;
}
nda.push_back(nd);
if (dns.is_object()) {
json nd;
nd["domain"] = dns["domain"];
json &srv = dns["servers"];
if (srv.is_array()) {
json ns = json::array();
for(unsigned int i=0;i<srv.size();++i) {
ns.push_back(srv[i]);
}
nd["servers"] = ns;
}
network["dns"] = nda;
network["dns"] = nd;
}
}