From 24de98e188fc428397eae4452583d46112633a58 Mon Sep 17 00:00:00 2001 From: Matthias Radestock Date: Fri, 28 Aug 2015 18:08:24 +0100 Subject: [PATCH] refactor --- proxy/create_exec_interceptor.go | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/proxy/create_exec_interceptor.go b/proxy/create_exec_interceptor.go index 841ff145..2ba19a61 100644 --- a/proxy/create_exec_interceptor.go +++ b/proxy/create_exec_interceptor.go @@ -31,21 +31,21 @@ func (i *createExecInterceptor) InterceptRequest(r *http.Request) error { return err } - _, hasWeaveWait := container.Volumes["/w"] + if _, hasWeaveWait := container.Volumes["/w"]; !hasWeaveWait { + return nil + } + cidrs, err := i.proxy.weaveCIDRsFromConfig(container.Config, container.HostConfig) if err != nil { Info.Printf("Ignoring container %s due to %s", container.ID, err) - } else if hasWeaveWait { - Info.Printf("Exec in container %s with WEAVE_CIDR \"%s\"", container.ID, strings.Join(cidrs, " ")) - cmd := append(weaveWaitEntrypoint, "-s") - options.Cmd = append(cmd, options.Cmd...) - - if err := marshalRequestBody(r, options); err != nil { - return err - } + return nil } - return nil + Info.Printf("Exec in container %s with WEAVE_CIDR \"%s\"", container.ID, strings.Join(cidrs, " ")) + cmd := append(weaveWaitEntrypoint, "-s") + options.Cmd = append(cmd, options.Cmd...) + + return marshalRequestBody(r, options) } func (i *createExecInterceptor) InterceptResponse(r *http.Response) error {