disable resolvctl dns

This commit is contained in:
Matthew R. Kasun
2022-03-03 15:07:27 -05:00
parent 9bd0af7e9c
commit d7b0852e24
2 changed files with 37 additions and 39 deletions

View File

@@ -7,7 +7,6 @@ import (
"errors"
"fmt"
"log"
"os/exec"
"runtime"
nodepb "github.com/gravitl/netmaker/grpc"
@@ -110,14 +109,14 @@ func JoinNetwork(cfg config.ClientConfig, privateKey string, iscomms bool) error
}
}
if ncutils.IsLinux() {
_, err := exec.LookPath("resolvectl")
if err != nil {
ncutils.PrintLog("resolvectl not present", 2)
ncutils.PrintLog("unable to configure DNS automatically, disabling automated DNS management", 2)
cfg.Node.DNSOn = "no"
}
}
// if ncutils.IsLinux() {
// _, err := exec.LookPath("resolvectl")
// if err != nil {
// ncutils.PrintLog("resolvectl not present", 2)
// ncutils.PrintLog("unable to configure DNS automatically, disabling automated DNS management", 2)
// cfg.Node.DNSOn = "no"
// }
// }
if ncutils.IsFreeBSD() {
cfg.Node.UDPHolePunch = "no"
}
@@ -236,20 +235,20 @@ func JoinNetwork(cfg config.ClientConfig, privateKey string, iscomms bool) error
if err != nil {
return err
}
if node.DNSOn == "yes" {
for _, server := range node.NetworkSettings.DefaultServerAddrs {
if server.IsLeader {
go func() {
if !local.SetDNSWithRetry(node, server.Address) {
cfg.Node.DNSOn = "no"
var currentCommsCfg = getCommsCfgByNode(&cfg.Node)
PublishNodeUpdate(&currentCommsCfg, &cfg)
}
}()
break
}
}
}
// if node.DNSOn == "yes" {
// for _, server := range node.NetworkSettings.DefaultServerAddrs {
// if server.IsLeader {
// go func() {
// if !local.SetDNSWithRetry(node, server.Address) {
// cfg.Node.DNSOn = "no"
// var currentCommsCfg = getCommsCfgByNode(&cfg.Node)
// PublishNodeUpdate(&currentCommsCfg, &cfg)
// }
// }()
// break
// }
// }
// }
if !iscomms {
if cfg.Daemon != "off" {