diff --git a/hack/vendor.sh b/hack/vendor.sh index 2c9c286b8b..a72662ea03 100755 --- a/hack/vendor.sh +++ b/hack/vendor.sh @@ -24,7 +24,7 @@ clone git golang.org/x/net 78cb2c067747f08b343f20614155233ab4ea2ad3 https://gith clone git golang.org/x/sys eb2c74142fd19a79b3f237334c7384d5167b1b46 https://github.com/golang/sys.git clone git github.com/docker/go-units 651fc226e7441360384da338d0fd37f2440ffbe3 clone git github.com/docker/go-connections v0.2.0 -clone git github.com/docker/engine-api 1fb8f09960cc32b9648495a422c960fb2a4f8a09 +clone git github.com/docker/engine-api e374c4fb5b121a8fd4295ec5eb91a8068c6304f4 clone git github.com/RackSec/srslog 259aed10dfa74ea2961eddd1d9847619f6e98837 clone git github.com/imdario/mergo 0.2.1 diff --git a/runconfig/hostconfig_test.go b/runconfig/hostconfig_test.go index e14443ba98..1fbc90a4cf 100644 --- a/runconfig/hostconfig_test.go +++ b/runconfig/hostconfig_test.go @@ -166,7 +166,7 @@ func TestPidModeTest(t *testing.T) { func TestRestartPolicy(t *testing.T) { restartPolicies := map[container.RestartPolicy][]bool{ // none, always, failure - container.RestartPolicy{}: {false, false, false}, + container.RestartPolicy{}: {true, false, false}, container.RestartPolicy{"something", 0}: {false, false, false}, container.RestartPolicy{"no", 0}: {true, false, false}, container.RestartPolicy{"always", 0}: {false, true, false}, diff --git a/vendor/src/github.com/docker/engine-api/client/image_build.go b/vendor/src/github.com/docker/engine-api/client/image_build.go index 4165c4e9a8..0ceb88cf68 100644 --- a/vendor/src/github.com/docker/engine-api/client/image_build.go +++ b/vendor/src/github.com/docker/engine-api/client/image_build.go @@ -8,7 +8,6 @@ import ( "net/url" "regexp" "strconv" - "strings" "golang.org/x/net/context" @@ -118,18 +117,3 @@ func getDockerOS(serverHeader string) string { } return osType } - -// convertKVStringsToMap converts ["key=value"] to {"key":"value"} -func convertKVStringsToMap(values []string) map[string]string { - result := make(map[string]string, len(values)) - for _, value := range values { - kv := strings.SplitN(value, "=", 2) - if len(kv) == 1 { - result[kv[0]] = "" - } else { - result[kv[0]] = kv[1] - } - } - - return result -} diff --git a/vendor/src/github.com/docker/engine-api/client/image_pull.go b/vendor/src/github.com/docker/engine-api/client/image_pull.go index 9287604a47..e2c49ec52b 100644 --- a/vendor/src/github.com/docker/engine-api/client/image_pull.go +++ b/vendor/src/github.com/docker/engine-api/client/image_pull.go @@ -32,7 +32,7 @@ func (cli *Client) ImagePull(ctx context.Context, ref string, options types.Imag } resp, err := cli.tryImageCreate(ctx, query, options.RegistryAuth) - if resp.statusCode == http.StatusUnauthorized { + if resp.statusCode == http.StatusUnauthorized && options.PrivilegeFunc != nil { newAuthHeader, privilegeErr := options.PrivilegeFunc() if privilegeErr != nil { return nil, privilegeErr diff --git a/vendor/src/github.com/docker/engine-api/client/image_push.go b/vendor/src/github.com/docker/engine-api/client/image_push.go index 9c837a76d1..89191ee30d 100644 --- a/vendor/src/github.com/docker/engine-api/client/image_push.go +++ b/vendor/src/github.com/docker/engine-api/client/image_push.go @@ -35,7 +35,7 @@ func (cli *Client) ImagePush(ctx context.Context, ref string, options types.Imag query.Set("tag", tag) resp, err := cli.tryImagePush(ctx, distributionRef.Name(), query, options.RegistryAuth) - if resp.statusCode == http.StatusUnauthorized { + if resp.statusCode == http.StatusUnauthorized && options.PrivilegeFunc != nil { newAuthHeader, privilegeErr := options.PrivilegeFunc() if privilegeErr != nil { return nil, privilegeErr diff --git a/vendor/src/github.com/docker/engine-api/client/image_search.go b/vendor/src/github.com/docker/engine-api/client/image_search.go index 571ba3df36..312e5b1efa 100644 --- a/vendor/src/github.com/docker/engine-api/client/image_search.go +++ b/vendor/src/github.com/docker/engine-api/client/image_search.go @@ -27,7 +27,7 @@ func (cli *Client) ImageSearch(ctx context.Context, term string, options types.I } resp, err := cli.tryImageSearch(ctx, query, options.RegistryAuth) - if resp.statusCode == http.StatusUnauthorized { + if resp.statusCode == http.StatusUnauthorized && options.PrivilegeFunc != nil { newAuthHeader, privilegeErr := options.PrivilegeFunc() if privilegeErr != nil { return results, privilegeErr diff --git a/vendor/src/github.com/docker/engine-api/client/request.go b/vendor/src/github.com/docker/engine-api/client/request.go index cdbb0975bd..5b283a4f95 100644 --- a/vendor/src/github.com/docker/engine-api/client/request.go +++ b/vendor/src/github.com/docker/engine-api/client/request.go @@ -85,6 +85,10 @@ func (cli *Client) sendClientRequest(ctx context.Context, method, path string, q } req, err := cli.newRequest(method, path, query, body, headers) + if err != nil { + return serverResp, err + } + if cli.proto == "unix" || cli.proto == "npipe" { // For local communications, it doesn't matter what the host is. We just // need a valid and meaningful host name. (See #189) @@ -98,10 +102,6 @@ func (cli *Client) sendClientRequest(ctx context.Context, method, path string, q } resp, err := cancellable.Do(ctx, cli.transport, req) - if resp != nil { - serverResp.statusCode = resp.StatusCode - } - if err != nil { if isTimeout(err) || strings.Contains(err.Error(), "connection refused") || strings.Contains(err.Error(), "dial unix") { return serverResp, ErrConnectionFailed @@ -110,6 +110,7 @@ func (cli *Client) sendClientRequest(ctx context.Context, method, path string, q if !cli.transport.Secure() && strings.Contains(err.Error(), "malformed HTTP response") { return serverResp, fmt.Errorf("%v.\n* Are you trying to connect to a TLS-enabled daemon without TLS?", err) } + if cli.transport.Secure() && strings.Contains(err.Error(), "remote error: bad certificate") { return serverResp, fmt.Errorf("The server probably has client authentication (--tlsverify) enabled. Please check your TLS client certification settings: %v", err) } @@ -117,6 +118,10 @@ func (cli *Client) sendClientRequest(ctx context.Context, method, path string, q return serverResp, fmt.Errorf("An error occurred trying to connect: %v", err) } + if resp != nil { + serverResp.statusCode = resp.StatusCode + } + if serverResp.statusCode < 200 || serverResp.statusCode >= 400 { body, err := ioutil.ReadAll(resp.Body) if err != nil { diff --git a/vendor/src/github.com/docker/engine-api/types/container/host_config.go b/vendor/src/github.com/docker/engine-api/types/container/host_config.go index 2446c1904d..531408c94d 100644 --- a/vendor/src/github.com/docker/engine-api/types/container/host_config.go +++ b/vendor/src/github.com/docker/engine-api/types/container/host_config.go @@ -195,7 +195,7 @@ type RestartPolicy struct { // IsNone indicates whether the container has the "no" restart policy. // This means the container will not automatically restart when exiting. func (rp *RestartPolicy) IsNone() bool { - return rp.Name == "no" + return rp.Name == "no" || rp.Name == "" } // IsAlways indicates whether the container has the "always" restart policy. diff --git a/vendor/src/github.com/docker/engine-api/types/events/events.go b/vendor/src/github.com/docker/engine-api/types/events/events.go index c5987aaf14..bbb72500ca 100644 --- a/vendor/src/github.com/docker/engine-api/types/events/events.go +++ b/vendor/src/github.com/docker/engine-api/types/events/events.go @@ -9,6 +9,8 @@ const ( VolumeEventType = "volume" // NetworkEventType is the event type that networks generate NetworkEventType = "network" + // DaemonEventType is the event type that daemon generate + DaemonEventType = "daemon" ) // Actor describes something that generates events,