Merge pull request #1944 from weaveworks/issues/1940-remove-proxy-weaveps-dep
Use netlink instead of shelling out to `weave ps`
This commit is contained in:
commit
1d3c80ab49
10 files changed
+183
-64
No files matched your search
+16
-5
@@ -62,6 +62,7 @@ type Config struct {
|
||||
WithoutDNS bool
|
||||
NoMulticastRoute bool
|
||||
DockerHost string
|
||||
ProcPath string
|
||||
}
|
||||
|
||||
type wait struct {
|
||||
@@ -570,11 +571,21 @@ func (proxy *Proxy) updateContainerNetworkSettings(container jsonObject) error {
|
||||
return err
|
||||
}
|
||||
|
||||
state, err := container.Object("State")
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
pid, err := state.Int("Pid")
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if err := proxy.waitForStartByIdent(containerID); err != nil {
|
||||
return err
|
||||
}
|
||||
mac, ips, nets, err := weaveContainerIPs(containerID)
|
||||
if err != nil || len(ips) == 0 {
|
||||
netDevs, err := GetWeaveNetDevs(proxy.ProcPath, pid)
|
||||
if err != nil || len(netDevs) == 0 || len(netDevs[0].CIDRs) == 0 {
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -582,9 +593,9 @@ func (proxy *Proxy) updateContainerNetworkSettings(container jsonObject) error {
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
networkSettings["MacAddress"] = mac
|
||||
networkSettings["IPAddress"] = ips[0].String()
|
||||
networkSettings["IPPrefixLen"], _ = nets[0].Mask.Size()
|
||||
networkSettings["MacAddress"] = netDevs[0].MAC.String()
|
||||
networkSettings["IPAddress"] = netDevs[0].CIDRs[0].IP.String()
|
||||
networkSettings["IPPrefixLen"], _ = netDevs[0].CIDRs[0].Mask.Size()
|
||||
return nil
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user