feat(NET-591): allow generic DNS entries (#2568)

This commit is contained in:
pwillis7 2023-09-20 12:20:08 +00:00 committed by GitHub
parent 7c4870e82f
commit fe842e0f05
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 4 additions and 4 deletions

View file

@ -238,7 +238,7 @@ func TestSetDNS(t *testing.T) {
assert.False(t, info.IsDir())
content, err := os.ReadFile("./config/dnsconfig/netmaker.hosts")
assert.Nil(t, err)
assert.Contains(t, string(content), "linuxhost.skynet")
assert.Contains(t, string(content), "linuxhost")
})
t.Run("EntryExists", func(t *testing.T) {
entry := models.DNSEntry{Address: "10.0.0.3", Name: "newhost", Network: "skynet"}
@ -251,7 +251,7 @@ func TestSetDNS(t *testing.T) {
assert.False(t, info.IsDir())
content, err := os.ReadFile("./config/dnsconfig/netmaker.hosts")
assert.Nil(t, err)
assert.Contains(t, string(content), "newhost.skynet")
assert.Contains(t, string(content), "newhost")
})
}

View file

@ -32,7 +32,7 @@ func SetDNS() error {
return err
}
for _, entry := range dns {
hostfile.AddHost(entry.Address, entry.Name+"."+entry.Network)
hostfile.AddHost(entry.Address, entry.Name)
}
}
if corefilestring == "" {

View file

@ -315,7 +315,7 @@ func PublishDeleteExtClientDNS(client *models.ExtClient) error {
func PublishCustomDNS(entry *models.DNSEntry) error {
dns := models.DNSUpdate{
Action: models.DNSInsert,
Name: entry.Name + "." + entry.Network,
Name: entry.Name,
//entry.Address6 is never used
Address: entry.Address,
}