Browse code

Vendor engine-api with pull fixes

Signed-off-by: Vincent Demeester <vincent@sbr.pm>

Vincent Demeester authored on 2016/04/27 02:00:35
Showing 12 changed files
... ...
@@ -25,7 +25,7 @@ clone git golang.org/x/net 78cb2c067747f08b343f20614155233ab4ea2ad3 https://gith
25 25
 clone git golang.org/x/sys eb2c74142fd19a79b3f237334c7384d5167b1b46 https://github.com/golang/sys.git
26 26
 clone git github.com/docker/go-units 651fc226e7441360384da338d0fd37f2440ffbe3
27 27
 clone git github.com/docker/go-connections v0.2.0
28
-clone git github.com/docker/engine-api a2999dbd3471ffe167f2aec7dccb9fa9b016dcbc
28
+clone git github.com/docker/engine-api b7e5e1ecd6121d7b643d607f20ced0cb5c93739c
29 29
 clone git github.com/RackSec/srslog 259aed10dfa74ea2961eddd1d9847619f6e98837
30 30
 clone git github.com/imdario/mergo 0.2.1
31 31
 
... ...
@@ -21,7 +21,7 @@ type Client struct {
21 21
 	addr string
22 22
 	// basePath holds the path to prepend to the requests.
23 23
 	basePath string
24
-	// transport is the interface to sends request with, it implements transport.Client.
24
+	// transport is the interface to send request with, it implements transport.Client.
25 25
 	transport transport.Client
26 26
 	// version of the server to talk to.
27 27
 	version string
... ...
@@ -27,7 +27,7 @@ func (cli *Client) ImagePull(ctx context.Context, ref string, options types.Imag
27 27
 
28 28
 	query := url.Values{}
29 29
 	query.Set("fromImage", repository)
30
-	if tag != "" {
30
+	if tag != "" && !options.All {
31 31
 		query.Set("tag", tag)
32 32
 	}
33 33
 
... ...
@@ -10,7 +10,6 @@ import (
10 10
 
11 11
 	distreference "github.com/docker/distribution/reference"
12 12
 	"github.com/docker/engine-api/types"
13
-	"github.com/docker/engine-api/types/reference"
14 13
 )
15 14
 
16 15
 // ImagePush requests the docker host to push an image to a remote registry.
... ...
@@ -27,7 +26,10 @@ func (cli *Client) ImagePush(ctx context.Context, ref string, options types.Imag
27 27
 		return nil, errors.New("cannot push a digest reference")
28 28
 	}
29 29
 
30
-	tag := reference.GetTagFromNamedRef(distributionRef)
30
+	var tag = ""
31
+	if nameTaggedRef, isNamedTagged := distributionRef.(distreference.NamedTagged); isNamedTagged {
32
+		tag = nameTaggedRef.Tag()
33
+	}
31 34
 
32 35
 	query := url.Values{}
33 36
 	query.Set("tag", tag)
... ...
@@ -85,6 +85,11 @@ func (cli *Client) sendClientRequest(ctx context.Context, method, path string, q
85 85
 	}
86 86
 
87 87
 	req, err := cli.newRequest(method, path, query, body, headers)
88
+	if cli.proto == "unix" || cli.proto == "npipe" {
89
+		// For local communications, it doesn't matter what the host is. We just
90
+		// need a valid and meaningful host name. (See #189)
91
+		req.Host = "docker"
92
+	}
88 93
 	req.URL.Host = cli.addr
89 94
 	req.URL.Scheme = cli.transport.Scheme()
90 95
 
91 96
new file mode 100644
... ...
@@ -0,0 +1,27 @@
0
+Copyright (c) 2009 The Go Authors. All rights reserved.
1
+
2
+Redistribution and use in source and binary forms, with or without
3
+modification, are permitted provided that the following conditions are
4
+met:
5
+
6
+   * Redistributions of source code must retain the above copyright
7
+notice, this list of conditions and the following disclaimer.
8
+   * Redistributions in binary form must reproduce the above
9
+copyright notice, this list of conditions and the following disclaimer
10
+in the documentation and/or other materials provided with the
11
+distribution.
12
+   * Neither the name of Google Inc. nor the names of its
13
+contributors may be used to endorse or promote products derived from
14
+this software without specific prior written permission.
15
+
16
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17
+"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18
+LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19
+A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
20
+OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21
+SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22
+LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23
+DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24
+THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26
+OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
... ...
@@ -178,6 +178,7 @@ type ImageLoadResponse struct {
178 178
 
179 179
 // ImagePullOptions holds information to pull images.
180 180
 type ImagePullOptions struct {
181
+	All           bool
181 182
 	RegistryAuth  string // RegistryAuth is the base64 encoded credentials for the registry
182 183
 	PrivilegeFunc RequestPrivilegeFunc
183 184
 }
... ...
@@ -38,7 +38,7 @@ type ContainerCommitConfig struct {
38 38
 	Config       *container.Config
39 39
 }
40 40
 
41
-// ExecConfig is a small subset of the Config struct that hold the configuration
41
+// ExecConfig is a small subset of the Config struct that holds the configuration
42 42
 // for the exec feature of docker.
43 43
 type ExecConfig struct {
44 44
 	User         string   // User that will run the command
... ...
@@ -25,7 +25,7 @@ func (i Isolation) IsDefault() bool {
25 25
 // IpcMode represents the container ipc stack.
26 26
 type IpcMode string
27 27
 
28
-// IsPrivate indicates whether the container uses it's private ipc stack.
28
+// IsPrivate indicates whether the container uses its private ipc stack.
29 29
 func (n IpcMode) IsPrivate() bool {
30 30
 	return !(n.IsHost() || n.IsContainer())
31 31
 }
... ...
@@ -186,7 +186,7 @@ func (rp *RestartPolicy) IsAlways() bool {
186 186
 }
187 187
 
188 188
 // IsOnFailure indicates whether the container has the "on-failure" restart policy.
189
-// This means the contain will automatically restart of exiting with a non-zero exit status.
189
+// This means the container will automatically restart of exiting with a non-zero exit status.
190 190
 func (rp *RestartPolicy) IsOnFailure() bool {
191 191
 	return rp.Name == "on-failure"
192 192
 }
... ...
@@ -4,7 +4,7 @@ import (
4 4
 	distreference "github.com/docker/distribution/reference"
5 5
 )
6 6
 
7
-// Parse parses the given references and return the repository and
7
+// Parse parses the given references and returns the repository and
8 8
 // tag (if present) from it. If there is an error during parsing, it will
9 9
 // return an error.
10 10
 func Parse(ref string) (string, string, error) {
... ...
@@ -18,7 +18,7 @@ func Parse(ref string) (string, string, error) {
18 18
 }
19 19
 
20 20
 // GetTagFromNamedRef returns a tag from the specified reference.
21
-// This function is necessary as long as the docker "server" api make the distinction between repository
21
+// This function is necessary as long as the docker "server" api makes the distinction between repository
22 22
 // and tags.
23 23
 func GetTagFromNamedRef(ref distreference.Named) string {
24 24
 	var tag string
... ...
@@ -27,6 +27,8 @@ func GetTagFromNamedRef(ref distreference.Named) string {
27 27
 		tag = x.Digest().String()
28 28
 	case distreference.NamedTagged:
29 29
 		tag = x.Tag()
30
+	default:
31
+		tag = "latest"
30 32
 	}
31 33
 	return tag
32 34
 }
... ...
@@ -82,7 +82,7 @@ type SearchResult struct {
82 82
 	IsOfficial bool `json:"is_official"`
83 83
 	// Name is the name of the repository
84 84
 	Name string `json:"name"`
85
-	// IsOfficial indicates whether the result is trusted
85
+	// IsTrusted indicates whether the result is trusted
86 86
 	IsTrusted bool `json:"is_trusted"`
87 87
 	// IsAutomated indicates whether the result is automated
88 88
 	IsAutomated bool `json:"is_automated"`
... ...
@@ -27,7 +27,7 @@ type ContainerConfig struct {
27 27
 	VolumeDriver string
28 28
 }
29 29
 
30
-// StatsJSON is a backcompatibility struct used in Stats for API prior to 1.21
30
+// StatsJSON is a backcompatibility struct used in Stats for APIs prior to 1.21
31 31
 type StatsJSON struct {
32 32
 	types.Stats
33 33
 	Network types.NetworkStats `json:"network,omitempty"`