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

Merge pull request #23226 from HackToday/fixnetinspectId

Fix the network inspect id
This commit is contained in:
Vincent Demeester 2016-06-07 10:02:17 +02:00
commit f9021838b6
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{}