mirror of
https://github.com/siderolabs/talos.git
synced 2025-10-28 23:11:37 +01:00
feat: add domain search line to resolv.conf
If we have a domainname, add it as a search root in resolv.conf. Fixes #1626 Signed-off-by: Seán C McCord <ulexus@gmail.com>
This commit is contained in:
parent
549db4d3b1
commit
b597306989
@ -12,6 +12,8 @@ import (
|
|||||||
"net"
|
"net"
|
||||||
"strings"
|
"strings"
|
||||||
"text/template"
|
"text/template"
|
||||||
|
|
||||||
|
talosnet "github.com/talos-systems/talos/pkg/net"
|
||||||
)
|
)
|
||||||
|
|
||||||
// filterInterfaceByName filters network links by name so we only mange links
|
// filterInterfaceByName filters network links by name so we only mange links
|
||||||
@ -49,6 +51,14 @@ func writeResolvConf(resolvers []string) (err error) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if domain, err := talosnet.DomainName(); err == nil {
|
||||||
|
if domain != "" {
|
||||||
|
if _, err = resolvconf.WriteString(fmt.Sprintf("search %s\n", domain)); err != nil {
|
||||||
|
return fmt.Errorf("failed to add domain search line to resolvconf: %s", err)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
log.Println("writing resolvconf")
|
log.Println("writing resolvconf")
|
||||||
|
|
||||||
return ioutil.WriteFile("/etc/resolv.conf", []byte(resolvconf.String()), 0644)
|
return ioutil.WriteFile("/etc/resolv.conf", []byte(resolvconf.String()), 0644)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user