From ec420c66d487e4136e2cfcdcfff1c8a7d811fd75 Mon Sep 17 00:00:00 2001 From: Bryan Boreham Date: Tue, 1 Dec 2015 16:40:19 +0000 Subject: [PATCH] Review feedback --- common/docker/client.go | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/common/docker/client.go b/common/docker/client.go index f6de8981..bd4b78f6 100644 --- a/common/docker/client.go +++ b/common/docker/client.go @@ -1,7 +1,9 @@ package docker import ( + "errors" "github.com/fsouza/go-dockerclient" + . "github.com/weaveworks/weave/common" ) @@ -100,9 +102,8 @@ func (c *Client) GetContainerIP(nameOrID string) (string, error) { } else if info.HostConfig.NetworkMode == "host" { return "127.0.0.1", nil } + if info.NetworkSettings.IPAddress == "" { + return "", errors.New("No IP address found for container " + nameOrID) + } return info.NetworkSettings.IPAddress, nil } - -func (c *Client) InspectContainer(nameOrId string) (*docker.Container, error) { - return c.Client.InspectContainer(nameOrId) -}