mirror of
https://github.com/rancher/os.git
synced 2025-09-19 00:59:53 +00:00
Update rancher/netconf in Godeps
This commit is contained in:
2
Godeps/Godeps.json
generated
2
Godeps/Godeps.json
generated
@@ -368,7 +368,7 @@
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/rancher/netconf",
|
||||
"Rev": "157105e12d6963f6a1c5765540261f6878f0de89"
|
||||
"Rev": "b9aeb623c8ef9551d79efec57ee059658c1ac89c"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/ryanuber/go-glob",
|
||||
|
28
Godeps/_workspace/src/github.com/rancher/netconf/netconf.go
generated
vendored
28
Godeps/_workspace/src/github.com/rancher/netconf/netconf.go
generated
vendored
@@ -42,6 +42,8 @@ func ApplyNetworkConfigs(netCfg *NetworkConfig) error {
|
||||
return err
|
||||
}
|
||||
|
||||
dhcpLinks := []string{}
|
||||
|
||||
//apply network config
|
||||
for _, link := range links {
|
||||
linkName := link.Attrs().Name
|
||||
@@ -80,13 +82,25 @@ func ApplyNetworkConfigs(netCfg *NetworkConfig) error {
|
||||
}
|
||||
|
||||
if match.Match != "" {
|
||||
err = applyNetConf(link, match)
|
||||
if err != nil {
|
||||
if match.DHCP {
|
||||
dhcpLinks = append(dhcpLinks, link.Attrs().Name)
|
||||
} else if err = applyNetConf(link, match); err != nil {
|
||||
log.Errorf("Failed to apply settings to %s : %v", linkName, err)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if len(dhcpLinks) > 0 {
|
||||
log.Infof("Running DHCP on %v", dhcpLinks)
|
||||
dhcpcdArgs := append([]string{"-MA4", "-e", "force_hostname=true"}, dhcpLinks...)
|
||||
cmd := exec.Command("dhcpcd", dhcpcdArgs...)
|
||||
cmd.Stdout = os.Stdout
|
||||
cmd.Stderr = os.Stderr
|
||||
if err := cmd.Run(); err != nil {
|
||||
log.Error(err)
|
||||
}
|
||||
}
|
||||
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
@@ -95,15 +109,7 @@ func ApplyNetworkConfigs(netCfg *NetworkConfig) error {
|
||||
}
|
||||
|
||||
func applyNetConf(link netlink.Link, netConf InterfaceConfig) error {
|
||||
if netConf.DHCP {
|
||||
log.Infof("Running DHCP on %s", link.Attrs().Name)
|
||||
cmd := exec.Command("dhcpcd", "-A4", "-e", "force_hostname=true", link.Attrs().Name)
|
||||
cmd.Stdout = os.Stdout
|
||||
cmd.Stderr = os.Stderr
|
||||
if err := cmd.Run(); err != nil {
|
||||
log.Error(err)
|
||||
}
|
||||
} else if netConf.IPV4LL {
|
||||
if netConf.IPV4LL {
|
||||
if err := AssignLinkLocalIP(link); err != nil {
|
||||
log.Errorf("IPV4LL set failed: %v", err)
|
||||
return err
|
||||
|
Reference in New Issue
Block a user