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

Fix the network inspect id

This fixes #22231

Signed-off-by: Kai Qiang Wu(Kennan) <wkqwu@cn.ibm.com>
This commit is contained in:
Kai Qiang Wu(Kennan) 2016-06-06 15:19:09 +00:00
parent 07a7c0632f
commit 864e362aa0
2 changed files with 12 additions and 2 deletions

View file

@ -36,8 +36,7 @@ func runInspect(dockerCli *client.DockerCli, opts inspectOptions) error {
client := dockerCli.Client()
getNetFunc := func(name string) (interface{}, []byte, error) {
i, err := client.NetworkInspect(context.Background(), name)
return i, nil, err
return client.NetworkInspectWithRaw(context.Background(), name)
}
return inspect.Inspect(dockerCli.Out(), opts.names, opts.format, getNetFunc)

View file

@ -427,6 +427,17 @@ func (s *DockerSuite) TestDockerNetworkInspect(c *check.C) {
c.Assert(strings.TrimSpace(out), check.Equals, "host")
}
func (s *DockerSuite) TestDockerNetworkInspectWithID(c *check.C) {
out, _ := dockerCmd(c, "network", "create", "test2")
networkID := strings.TrimSpace(out)
assertNwIsAvailable(c, "test2")
out, _ = dockerCmd(c, "network", "inspect", "--format={{ .Id }}", "test2")
c.Assert(strings.TrimSpace(out), check.Equals, networkID)
out, _ = dockerCmd(c, "network", "inspect", "--format={{ .ID }}", "test2")
c.Assert(strings.TrimSpace(out), check.Equals, networkID)
}
func (s *DockerSuite) TestDockerInspectMultipleNetwork(c *check.C) {
out, _ := dockerCmd(c, "network", "inspect", "host", "none")
networkResources := []types.NetworkResource{}