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")) { if (b.count("dns")) {
json &dns = b["dns"]; json &dns = b["dns"];
if (dns.is_array()) { if (dns.is_object()) {
json nda = json::array(); json nd;
for(unsigned int i=0;i<dns.size();++i) {
json &d = dns[i]; nd["domain"] = dns["domain"];
if (d.is_object()) {
json nd = json::object(); json &srv = dns["servers"];
nd["domain"] = d["domain"]; if (srv.is_array()) {
json &srv = d["servers"]; json ns = json::array();
if (srv.is_array()) { for(unsigned int i=0;i<srv.size();++i) {
json ns = json::array(); ns.push_back(srv[i]);
for(unsigned int j=0;j<srv.size();++j) {
ns.push_back(srv[i]);
}
nd["servers"] = ns;
}
nda.push_back(nd);
} }
nd["servers"] = ns;
} }
network["dns"] = nda;
network["dns"] = nd;
} }
} }