1
0
Fork 0
mirror of https://github.com/moby/moby.git synced 2022-11-09 12:21:53 -05:00
moby--moby/api/server/router/network
Yong Tang abf31ee083 Return error in case docker network inspect is ambiguous
This fix is partially based on comment
https://github.com/docker/docker/issues/30242#issuecomment-273517205

Currently, `docker network inspect` relies on `FindNetwork()` which
does not take into consideration that multiple networks with the same
name might exist.

This fix propose to return `docker network inspect` in a similiar
fashion like other commands:
1. Lookup full ID
2. Lookup full name
3. Lookup partial ID
If multiple networks exist, an error will be returned.

NOTE: this fix is not a complete fix for the issue raised in
https://github.com/docker/docker/issues/30242#issuecomment-273517205
where SwarmKit is unable to update when multiple networks with the same
name exit.
To fix that issue requires multiple places when `FindNetwork()` is called.
Because of the impact of changing `FindNetwork()`, this fix focus on
the issue in `docker network inspect`.

A separate PR will be created to address
https://github.com/docker/docker/issues/30242#issuecomment-273517205

An integration test has been added.

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
2017-02-07 18:05:29 -08:00
..
backend.go Return error in case docker network inspect is ambiguous 2017-02-07 18:05:29 -08:00
filter.go Return [] instead of null in case filterNetworks returns empty 2017-01-11 01:56:11 -08:00
filter_test.go Return [] instead of null in case filterNetworks returns empty 2017-01-11 01:56:11 -08:00
network.go rename clusterProvider to cluster in router 2016-12-26 20:53:13 +08:00
network_routes.go Return error in case docker network inspect is ambiguous 2017-02-07 18:05:29 -08:00