1
0
Fork 0
mirror of https://github.com/moby/moby.git synced 2022-11-09 12:21:53 -05:00

Merge pull request #24365 from xianlubird/bug/network-list

Change buildEndpointResource params avoid repeat visits resource
This commit is contained in:
Brian Goff 2016-07-29 14:54:05 -04:00 committed by GitHub
commit 6bf2db574b

View file

@ -203,12 +203,13 @@ func (n *networkRouter) buildNetworkResource(nw libnetwork.Network) *types.Netwo
continue
}
sb := ei.Sandbox()
key := "ep-" + e.ID()
tmpID := e.ID()
key := "ep-" + tmpID
if sb != nil {
key = sb.ContainerID()
}
r.Containers[key] = buildEndpointResource(e)
r.Containers[key] = buildEndpointResource(tmpID, e.Name(), ei)
}
return r
}
@ -268,15 +269,12 @@ func buildIpamResources(r *types.NetworkResource, nwInfo libnetwork.NetworkInfo)
}
}
func buildEndpointResource(e libnetwork.Endpoint) types.EndpointResource {
func buildEndpointResource(id string, name string, info libnetwork.EndpointInfo) types.EndpointResource {
er := types.EndpointResource{}
if e == nil {
return er
}
er.EndpointID = e.ID()
er.Name = e.Name()
ei := e.Info()
er.EndpointID = id
er.Name = name
ei := info
if ei == nil {
return er
}