Merge pull request #12092 from tiborvass/no-jobs-networkdriver-bridge

Remove jobs from daemon/networkdriver/bridge
Upstream-commit: 67676529b373c39c239ff7c8f4a374ae97659523
Component: engine
This commit is contained in:
Alexander Morozov
2015-04-09 14:10:21 -07:00
11 changed files with 233 additions and 433 deletions

View File

@ -1,10 +1,10 @@
package client
import (
"encoding/json"
"fmt"
"strings"
"github.com/docker/docker/engine"
"github.com/docker/docker/nat"
flag "github.com/docker/docker/pkg/mflag"
)
@ -23,12 +23,13 @@ func (cli *DockerCli) CmdPort(args ...string) error {
return err
}
env := engine.Env{}
if err := env.Decode(stream); err != nil {
return err
var c struct {
NetworkSettings struct {
Ports nat.PortMap
}
}
ports := nat.PortMap{}
if err := env.GetSubEnv("NetworkSettings").GetJson("Ports", &ports); err != nil {
if err := json.NewDecoder(stream).Decode(&c); err != nil {
return err
}
@ -44,7 +45,7 @@ func (cli *DockerCli) CmdPort(args ...string) error {
proto = parts[1]
}
natPort := port + "/" + proto
if frontends, exists := ports[nat.Port(port+"/"+proto)]; exists && frontends != nil {
if frontends, exists := c.NetworkSettings.Ports[nat.Port(port+"/"+proto)]; exists && frontends != nil {
for _, frontend := range frontends {
fmt.Fprintf(cli.out, "%s:%s\n", frontend.HostIp, frontend.HostPort)
}
@ -53,7 +54,7 @@ func (cli *DockerCli) CmdPort(args ...string) error {
return fmt.Errorf("Error: No public port '%s' published for %s", natPort, cmd.Arg(0))
}
for from, frontends := range ports {
for from, frontends := range c.NetworkSettings.Ports {
for _, frontend := range frontends {
fmt.Fprintf(cli.out, "%s -> %s:%s\n", from, frontend.HostIp, frontend.HostPort)
}