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

Commit

Permalink
Merge pull request #150 from abhinandanpb/predefinednet
Browse files Browse the repository at this point in the history
[17.06] Changing get network request to return predefined network in swarm
  • Loading branch information
andrewhsu authored Aug 1, 2017
2 parents fd33a51 + dbe03d4 commit 2b8fb89
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions components/engine/api/server/router/network/network_routes.go
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,15 @@ func (n *networkRouter) getNetwork(ctx context.Context, w http.ResponseWriter, r
}
}

nwk, err := n.cluster.GetNetwork(term)
if err == nil {
// If the get network is passed with a specific network ID / partial network ID
// return the network.
if 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 2b8fb89

Please sign in to comment.