mirror of
https://github.com/gravitl/netmaker.git
synced 2025-10-08 02:06:06 +08:00
feat(NET-591): allow generic DNS entries (#2568)
This commit is contained in:
@@ -238,7 +238,7 @@ func TestSetDNS(t *testing.T) {
|
|||||||
assert.False(t, info.IsDir())
|
assert.False(t, info.IsDir())
|
||||||
content, err := os.ReadFile("./config/dnsconfig/netmaker.hosts")
|
content, err := os.ReadFile("./config/dnsconfig/netmaker.hosts")
|
||||||
assert.Nil(t, err)
|
assert.Nil(t, err)
|
||||||
assert.Contains(t, string(content), "linuxhost.skynet")
|
assert.Contains(t, string(content), "linuxhost")
|
||||||
})
|
})
|
||||||
t.Run("EntryExists", func(t *testing.T) {
|
t.Run("EntryExists", func(t *testing.T) {
|
||||||
entry := models.DNSEntry{Address: "10.0.0.3", Name: "newhost", Network: "skynet"}
|
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())
|
assert.False(t, info.IsDir())
|
||||||
content, err := os.ReadFile("./config/dnsconfig/netmaker.hosts")
|
content, err := os.ReadFile("./config/dnsconfig/netmaker.hosts")
|
||||||
assert.Nil(t, err)
|
assert.Nil(t, err)
|
||||||
assert.Contains(t, string(content), "newhost.skynet")
|
assert.Contains(t, string(content), "newhost")
|
||||||
})
|
})
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -32,7 +32,7 @@ func SetDNS() error {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
for _, entry := range dns {
|
for _, entry := range dns {
|
||||||
hostfile.AddHost(entry.Address, entry.Name+"."+entry.Network)
|
hostfile.AddHost(entry.Address, entry.Name)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if corefilestring == "" {
|
if corefilestring == "" {
|
||||||
|
@@ -315,7 +315,7 @@ func PublishDeleteExtClientDNS(client *models.ExtClient) error {
|
|||||||
func PublishCustomDNS(entry *models.DNSEntry) error {
|
func PublishCustomDNS(entry *models.DNSEntry) error {
|
||||||
dns := models.DNSUpdate{
|
dns := models.DNSUpdate{
|
||||||
Action: models.DNSInsert,
|
Action: models.DNSInsert,
|
||||||
Name: entry.Name + "." + entry.Network,
|
Name: entry.Name,
|
||||||
//entry.Address6 is never used
|
//entry.Address6 is never used
|
||||||
Address: entry.Address,
|
Address: entry.Address,
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user