mirror of
https://github.com/gravitl/netmaker.git
synced 2024-09-21 07:46:04 +08:00
Merge pull request #891 from gravitl/feature_0.12.0_host_dns
eliminate the need for a tmp file to update dns
This commit is contained in:
commit
8e000cb552
|
@ -3,7 +3,6 @@ package functions
|
|||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"os"
|
||||
"runtime"
|
||||
"strings"
|
||||
"time"
|
||||
|
@ -219,17 +218,7 @@ func setHostDNS(dns []byte, windows bool) error {
|
|||
if windows {
|
||||
etchosts = "c:\\windows\\system32\\drivers\\etc\\hosts"
|
||||
}
|
||||
tmpfile := "/tmp/dnsdata"
|
||||
if windows {
|
||||
tmpfile = "c:\\windows\\temp\\dnsdata"
|
||||
}
|
||||
if err := os.WriteFile(tmpfile, dns, 0600); err != nil {
|
||||
return err
|
||||
}
|
||||
dnsdata, err := os.Open(tmpfile)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
dnsdata := strings.NewReader(string(dns))
|
||||
profile, err := parser.ParseProfile(dnsdata)
|
||||
if err != nil {
|
||||
return err
|
||||
|
|
Loading…
Reference in a new issue