Browse code

add missing API changes

Signed-off-by: Victor Vieux <victorvieux@gmail.com>

Victor Vieux authored on 2017/02/19 17:43:08
Showing 5 changed files
... ...
@@ -520,9 +520,9 @@ func (s *containerRouter) wsContainersAttach(ctx context.Context, w http.Respons
520 520
 		}()
521 521
 
522 522
 		conn := <-wsChan
523
-		// In case version is higher than 1.26, a binary frame will be sent.
523
+		// In case version is higher than 1.27, a binary frame will be sent.
524 524
 		// See 28176 for details.
525
-		if versions.GreaterThanOrEqualTo(version, "1.26") {
525
+		if versions.GreaterThanOrEqualTo(version, "1.27") {
526 526
 			conn.PayloadType = websocket.BinaryFrame
527 527
 		}
528 528
 		return conn, conn, conn, nil
... ...
@@ -60,11 +60,11 @@ SKIP:
60 60
 		}
61 61
 
62 62
 		var nr *types.NetworkResource
63
-		// Versions < 1.26 fetches all the containers attached to a network
63
+		// Versions < 1.27 fetches all the containers attached to a network
64 64
 		// in a network list api call. It is a heavy weight operation when
65
-		// run across all the networks. Starting API version 1.26, this detailed
65
+		// run across all the networks. Starting API version 1.27, this detailed
66 66
 		// info is available for network specific GET API (equivalent to inspect)
67
-		if versions.LessThan(httputils.VersionFromContext(ctx), "1.26") {
67
+		if versions.LessThan(httputils.VersionFromContext(ctx), "1.27") {
68 68
 			nr = n.buildDetailedNetworkResources(nw)
69 69
 		} else {
70 70
 			nr = n.buildNetworkResource(nw)
... ...
@@ -469,7 +469,7 @@ func addServiceFlags(cmd *cobra.Command, opts *serviceOptions) {
469 469
 	flags.SetAnnotation(flagTTY, "version", []string{"1.25"})
470 470
 
471 471
 	flags.BoolVar(&opts.readOnly, flagReadOnly, false, "Mount the container's root filesystem as read only")
472
-	flags.SetAnnotation(flagReadOnly, "version", []string{"1.26"})
472
+	flags.SetAnnotation(flagReadOnly, "version", []string{"1.27"})
473 473
 }
474 474
 
475 475
 const (
... ...
@@ -53,13 +53,11 @@ import (
53 53
 	"path/filepath"
54 54
 	"strings"
55 55
 
56
+	"github.com/docker/docker/api"
56 57
 	"github.com/docker/go-connections/sockets"
57 58
 	"github.com/docker/go-connections/tlsconfig"
58 59
 )
59 60
 
60
-// DefaultVersion is the version of the current stable API
61
-const DefaultVersion string = "1.26"
62
-
63 61
 // Client is the API client that performs all operations
64 62
 // against a docker server.
65 63
 type Client struct {
... ...
@@ -115,7 +113,7 @@ func NewEnvClient() (*Client, error) {
115 115
 	}
116 116
 	version := os.Getenv("DOCKER_API_VERSION")
117 117
 	if version == "" {
118
-		version = DefaultVersion
118
+		version = api.DefaultVersion
119 119
 	}
120 120
 
121 121
 	cli, err := NewClient(host, version, client, nil)
... ...
@@ -11,6 +11,7 @@ import (
11 11
 	"strings"
12 12
 	"testing"
13 13
 
14
+	"github.com/docker/docker/api"
14 15
 	"github.com/docker/docker/api/types"
15 16
 	"golang.org/x/net/context"
16 17
 )
... ...
@@ -26,7 +27,7 @@ func TestNewEnvClient(t *testing.T) {
26 26
 	}{
27 27
 		{
28 28
 			envs:            map[string]string{},
29
-			expectedVersion: DefaultVersion,
29
+			expectedVersion: api.DefaultVersion,
30 30
 		},
31 31
 		{
32 32
 			envs: map[string]string{
... ...
@@ -38,21 +39,21 @@ func TestNewEnvClient(t *testing.T) {
38 38
 			envs: map[string]string{
39 39
 				"DOCKER_CERT_PATH": "testdata/",
40 40
 			},
41
-			expectedVersion: DefaultVersion,
41
+			expectedVersion: api.DefaultVersion,
42 42
 		},
43 43
 		{
44 44
 			envs: map[string]string{
45 45
 				"DOCKER_CERT_PATH":  "testdata/",
46 46
 				"DOCKER_TLS_VERIFY": "1",
47 47
 			},
48
-			expectedVersion: DefaultVersion,
48
+			expectedVersion: api.DefaultVersion,
49 49
 		},
50 50
 		{
51 51
 			envs: map[string]string{
52 52
 				"DOCKER_CERT_PATH": "testdata/",
53 53
 				"DOCKER_HOST":      "https://notaunixsocket",
54 54
 			},
55
-			expectedVersion: DefaultVersion,
55
+			expectedVersion: api.DefaultVersion,
56 56
 		},
57 57
 		{
58 58
 			envs: map[string]string{
... ...
@@ -64,7 +65,7 @@ func TestNewEnvClient(t *testing.T) {
64 64
 			envs: map[string]string{
65 65
 				"DOCKER_HOST": "invalid://url",
66 66
 			},
67
-			expectedVersion: DefaultVersion,
67
+			expectedVersion: api.DefaultVersion,
68 68
 		},
69 69
 		{
70 70
 			envs: map[string]string{
... ...
@@ -262,8 +263,8 @@ func TestNewEnvClientSetsDefaultVersion(t *testing.T) {
262 262
 	if err != nil {
263 263
 		t.Fatal(err)
264 264
 	}
265
-	if client.version != DefaultVersion {
266
-		t.Fatalf("Expected %s, got %s", DefaultVersion, client.version)
265
+	if client.version != api.DefaultVersion {
266
+		t.Fatalf("Expected %s, got %s", api.DefaultVersion, client.version)
267 267
 	}
268 268
 
269 269
 	expected := "1.22"