Merge pull request #1310 from weaveworks/improve_proxy_ignore_messages

Improve log messages for when the proxy ignores a container
This commit is contained in:
Paul Bellamy committed 2015-08-17 16:27:45 +01:00
commit 74883c5da8
4 files changed
+6 -6

No files matched your search

+1 -1
View File
@@ -54,7 +54,7 @@ func (i *createContainerInterceptor) InterceptRequest(r *http.Request) error {
}
if cidrs, err := i.proxy.weaveCIDRsFromConfig(container.Config, container.HostConfig); err != nil {
Log.Infof("Ignoring container due to %s", err)
Log.Infof("Leaving container alone because %s", err)
} else {
Log.Infof("Creating container with WEAVE_CIDR \"%s\"", strings.Join(cidrs, " "))
if container.HostConfig == nil {
+1 -1
View File
@@ -32,7 +32,7 @@ func (i *createExecInterceptor) InterceptRequest(r *http.Request) error {
_, hasWeaveWait := container.Volumes["/w"]
cidrs, err := i.proxy.weaveCIDRsFromConfig(container.Config, container.HostConfig)
if err != nil {
Log.Infof("Ignoring container %s due to %s", container.ID, err)
Log.Infof("Leaving container %s alone because %s", container.ID, err)
} else if hasWeaveWait {
Log.Infof("Exec in container %s with WEAVE_CIDR \"%s\"", container.ID, strings.Join(cidrs, " "))
cmd := append(weaveWaitEntrypoint, "-s")
+3 -3
View File
@@ -28,8 +28,8 @@ var (
containerStartRegexp = regexp.MustCompile("^(/v[0-9\\.]*)?/containers/[^/]*/(re)?start$")
execCreateRegexp = regexp.MustCompile("^(/v[0-9\\.]*)?/containers/[^/]*/exec$")
ErrWeaveCIDRNone = errors.New("WEAVE_CIDR=none")
ErrNoDefaultIPAM = errors.New("--no-default-ipalloc option")
ErrWeaveCIDRNone = errors.New("the container was created with the '-e WEAVE_CIDR=none' option")
ErrNoDefaultIPAM = errors.New("the container was created without specifying an IP address with '-e WEAVE_CIDR=...' and the proxy was started with the '--no-default-ipalloc' option")
)
type Config struct {
@@ -230,7 +230,7 @@ func (proxy *Proxy) weaveCIDRsFromConfig(config *docker.Config, hostConfig *dock
netMode = hostConfig.NetworkMode
}
if netMode == "host" || strings.HasPrefix(netMode, "container:") {
return nil, fmt.Errorf("--net option: %q", netMode)
return nil, fmt.Errorf("the container was created with the '--net=%s'", netMode)
}
for _, e := range config.Env {
if strings.HasPrefix(e, "WEAVE_CIDR=") {
+1 -1
View File
@@ -34,7 +34,7 @@ func (i *startContainerInterceptor) InterceptResponse(r *http.Response) error {
cidrs, err := i.proxy.weaveCIDRsFromConfig(container.Config, container.HostConfig)
if err != nil {
Log.Infof("Ignoring container %s due to %s", container.ID, err)
Log.Infof("Leaving container %s alone because %s", container.ID, err)
return nil
}
Log.Infof("Attaching container %s with WEAVE_CIDR \"%s\" to weave network", container.ID, strings.Join(cidrs, " "))