Skip to content
This repository has been archived by the owner on Oct 13, 2023. It is now read-only.

Commit

Permalink
Changing the get network request to return swarm scope predefined net…
Browse files Browse the repository at this point in the history
…works

Starting 17.06 swarm service create supports service creates with predefined
networks like host and bridge. Due to the nature of the feature, swarm manager
has a swarm scope predefined networks in addition to local scoped
predefined networks on all nodes. However network inspects for swarm scoped
predefined networks was not possible. The fix adds support for network inspect
for swarm scoped predefined networks.

Signed-off-by: Abhinandan Prativadi <abhi@docker.com>
  • Loading branch information
abhi committed Jul 28, 2017
1 parent 77b4dce commit d15bb75
Showing 1 changed file with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,13 @@ func (n *networkRouter) getNetwork(ctx context.Context, w http.ResponseWriter, r
listByPartialID[network.ID()] = *n.buildDetailedNetworkResources(network, verbose)
}
}

nwk, err := n.cluster.GetNetwork(term)
// If the get network inspect requests with network ID / partial network ID
if err == nil {
if nwk.ID == term || strings.HasPrefix(nwk.ID, term) {
return httputils.WriteJSON(w, http.StatusOK, nwk)
}
}
nr, _ := n.cluster.GetNetworks()
for _, network := range nr {
if network.ID == term {
Expand Down

0 comments on commit d15bb75

Please sign in to comment.