1
0
mirror of https://github.com/rancher/os.git synced 2025-09-01 14:48:55 +00:00

Remove DHCP override flag

This commit is contained in:
Josh Curl
2016-04-15 10:38:31 -07:00
parent 8b4e6cc502
commit 8862878337
8 changed files with 23 additions and 16 deletions

View File

@@ -182,7 +182,7 @@ func ApplyNetworkConfigs(netCfg *NetworkConfig) error {
return err
}
func RunDhcp(netCfg *NetworkConfig, dhcpHostname bool) error {
func RunDhcp(netCfg *NetworkConfig, setHostname, setDns bool) error {
links, err := netlink.LinkList()
if err != nil {
return err
@@ -200,7 +200,7 @@ func RunDhcp(netCfg *NetworkConfig, dhcpHostname bool) error {
for iface, args := range dhcpLinks {
wg.Add(1)
go func(iface, args string) {
runDhcp(netCfg, iface, args, dhcpHostname)
runDhcp(netCfg, iface, args, setHostname, setDns)
wg.Done()
}(iface, args)
}
@@ -209,7 +209,7 @@ func RunDhcp(netCfg *NetworkConfig, dhcpHostname bool) error {
return err
}
func runDhcp(netCfg *NetworkConfig, iface string, argstr string, dhcpHostname bool) {
func runDhcp(netCfg *NetworkConfig, iface string, argstr string, setHostname, setDns bool) {
log.Infof("Running DHCP on %s", iface)
args := []string{}
if argstr != "" {
@@ -223,12 +223,12 @@ func runDhcp(netCfg *NetworkConfig, iface string, argstr string, dhcpHostname bo
args = defaultDhcpArgs
}
if netCfg.Dns.Override {
args = append(args, "--nohook", "resolv.conf")
if setHostname {
args = append(args, "-e", "force_hostname=true")
}
if dhcpHostname {
args = append(args, "-e", "force_hostname=true")
if !setDns {
args = append(args, "--nohook", "resolv.conf")
}
args = append(args, iface)

View File

@@ -26,7 +26,6 @@ type InterfaceConfig struct {
}
type DnsConfig struct {
Override bool `yaml:"override"`
Nameservers []string `yaml:"nameservers,flow,omitempty"`
Search []string `yaml:"search,flow,omitempty"`
}