Skip to content
This repository was archived by the owner on Jul 18, 2025. It is now read-only.

Commit 949851c

Browse files
committed
Update vendor dependencies…
… and update code according to Signed-off-by: Vincent Demeester <[email protected]>
1 parent 1c4bd45 commit 949851c

File tree

490 files changed

+26323
-16477
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

490 files changed

+26323
-16477
lines changed

docker/auth/auth.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ package auth
22

33
import (
44
"github.com/docker/docker/api/types"
5-
"github.com/docker/docker/cliconfig/configfile"
5+
"github.com/docker/docker/cli/config/configfile"
66
"github.com/docker/docker/registry"
77
)
88

docker/builder/builder.go

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,10 @@ import (
88
"path/filepath"
99
"strings"
1010

11-
"golang.org/x/net/context"
12-
1311
"github.com/Sirupsen/logrus"
1412
"github.com/docker/docker/api/types"
15-
"github.com/docker/docker/builder"
1613
"github.com/docker/docker/builder/dockerignore"
14+
"github.com/docker/docker/cli/command/image/build"
1715
"github.com/docker/docker/client"
1816
"github.com/docker/docker/pkg/archive"
1917
"github.com/docker/docker/pkg/fileutils"
@@ -22,6 +20,7 @@ import (
2220
"github.com/docker/docker/pkg/streamformatter"
2321
"github.com/docker/docker/pkg/term"
2422
"github.com/docker/libcompose/logger"
23+
"golang.org/x/net/context"
2524
)
2625

2726
// DefaultDockerfileName is the default name of a Dockerfile
@@ -42,7 +41,7 @@ type DaemonBuilder struct {
4241
NoCache bool
4342
ForceRemove bool
4443
Pull bool
45-
BuildArgs map[string]string
44+
BuildArgs map[string]*string
4645
LoggerFactory logger.Factory
4746
}
4847

@@ -194,8 +193,8 @@ func CreateTar(contextDirectory, dockerfile string) (io.ReadCloser, error) {
194193
includes = append(includes, ".dockerignore", dockerfileName)
195194
}
196195

197-
if err := builder.ValidateContextDirectory(contextDirectory, excludes); err != nil {
198-
return nil, fmt.Errorf("Error checking context is accessible: '%s'. Please check permissions and try again.", err)
196+
if err := build.ValidateContextDirectory(contextDirectory, excludes); err != nil {
197+
return nil, fmt.Errorf("error checking context is accessible: '%s', please check permissions and try again", err)
199198
}
200199

201200
options := &archive.TarOptions{

docker/client/client.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import (
77
"path/filepath"
88
"runtime"
99

10-
"github.com/docker/docker/cliconfig"
10+
cliconfig "github.com/docker/docker/cli/config"
1111
"github.com/docker/docker/client"
1212
"github.com/docker/docker/pkg/homedir"
1313
"github.com/docker/go-connections/sockets"
@@ -30,7 +30,7 @@ var (
3030

3131
func init() {
3232
if dockerCertPath == "" {
33-
dockerCertPath = cliconfig.ConfigDir()
33+
dockerCertPath = cliconfig.Dir()
3434
}
3535
}
3636

docker/client/client_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import (
55
"os"
66
"testing"
77

8-
"github.com/docker/docker/cliconfig"
8+
cliconfig "github.com/docker/docker/cli/config"
99
"github.com/docker/go-connections/tlsconfig"
1010
)
1111

@@ -109,7 +109,7 @@ func TestCreateWithOptions(t *testing.T) {
109109
TLS: true,
110110
APIVersion: "v1.22",
111111
},
112-
expectedError: fmt.Sprintf("Could not load X509 key pair: open %s/cert.pem: no such file or directory. Make sure the key is not encrypted", cliconfig.ConfigDir()),
112+
expectedError: fmt.Sprintf("Could not load X509 key pair: open %s/cert.pem: no such file or directory. Make sure the key is not encrypted", cliconfig.Dir()),
113113
},
114114
{
115115
options: Options{

docker/container/functions.go

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
11
package container
22

33
import (
4-
"golang.org/x/net/context"
5-
64
"github.com/docker/docker/api/types"
75
"github.com/docker/docker/api/types/filters"
86
"github.com/docker/docker/client"
7+
"golang.org/x/net/context"
98
)
109

1110
// ListByFilter looks up the hosts containers with the specified filters and
@@ -23,8 +22,8 @@ func ListByFilter(ctx context.Context, clientInstance client.ContainerAPIClient,
2322
}
2423

2524
return clientInstance.ContainerList(ctx, types.ContainerListOptions{
26-
All: true,
27-
Filter: filterArgs,
25+
All: true,
26+
Filters: filterArgs,
2827
})
2928
}
3029

docker/ctx/context.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
package ctx
22

33
import (
4-
"github.com/docker/docker/cliconfig"
5-
"github.com/docker/docker/cliconfig/configfile"
4+
cliconfig "github.com/docker/docker/cli/config"
5+
"github.com/docker/docker/cli/config/configfile"
66
"github.com/docker/libcompose/docker/auth"
77
"github.com/docker/libcompose/docker/client"
88
"github.com/docker/libcompose/project"

docker/image/image.go

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,15 @@ import (
77
"io"
88
"os"
99

10-
"golang.org/x/net/context"
11-
1210
"github.com/Sirupsen/logrus"
11+
"github.com/docker/distribution/reference"
1312
"github.com/docker/docker/api/types"
1413
"github.com/docker/docker/client"
1514
"github.com/docker/docker/pkg/jsonmessage"
1615
"github.com/docker/docker/pkg/term"
17-
"github.com/docker/docker/reference"
1816
"github.com/docker/docker/registry"
1917
"github.com/docker/libcompose/docker/auth"
18+
"golang.org/x/net/context"
2019
)
2120

2221
// Exists return whether or not the service image already exists
@@ -49,7 +48,7 @@ func RemoveImage(ctx context.Context, client client.ImageAPIClient, image string
4948
// to the daemon store with the specified client.
5049
func PullImage(ctx context.Context, client client.ImageAPIClient, serviceName string, authLookup auth.Lookup, image string) error {
5150
fmt.Fprintf(os.Stderr, "Pulling %s (%s)...\n", serviceName, image)
52-
distributionRef, err := reference.ParseNamed(image)
51+
distributionRef, err := reference.ParseNormalizedNamed(image)
5352
if err != nil {
5453
return err
5554
}

docker/project.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ func (p *Project) RemoveOrphans(ctx context.Context, projectName string, service
8080
filter := filters.NewArgs()
8181
filter.Add("label", labels.PROJECT.EqString(projectName))
8282
containers, err := client.ContainerList(ctx, types.ContainerListOptions{
83-
Filter: filter,
83+
Filters: filter,
8484
})
8585
if err != nil {
8686
return err

docker/service/convert.go

Lines changed: 58 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@ import (
44
"fmt"
55
"strings"
66

7-
"golang.org/x/net/context"
8-
97
"github.com/docker/docker/api/types/container"
108
"github.com/docker/docker/api/types/network"
119
"github.com/docker/docker/api/types/strslice"
@@ -17,7 +15,7 @@ import (
1715
composecontainer "github.com/docker/libcompose/docker/container"
1816
"github.com/docker/libcompose/project"
1917
"github.com/docker/libcompose/utils"
20-
// "github.com/docker/libcompose/yaml"
18+
"golang.org/x/net/context"
2119
)
2220

2321
// ConfigWrapper wraps Config, HostConfig and NetworkingConfig for a container.
@@ -305,7 +303,7 @@ func parseDevices(devices []string) ([]container.DeviceMapping, error) {
305303
// parse device mappings
306304
deviceMappings := []container.DeviceMapping{}
307305
for _, device := range devices {
308-
v, err := opts.ParseDevice(device)
306+
v, err := parseDevice(device)
309307
if err != nil {
310308
return nil, err
311309
}
@@ -318,3 +316,59 @@ func parseDevices(devices []string) ([]container.DeviceMapping, error) {
318316

319317
return deviceMappings, nil
320318
}
319+
320+
// parseDevice parses a device mapping string to a container.DeviceMapping struct
321+
// FIXME(vdemeester) de-duplicate this by re-exporting it in docker/docker
322+
func parseDevice(device string) (container.DeviceMapping, error) {
323+
src := ""
324+
dst := ""
325+
permissions := "rwm"
326+
arr := strings.Split(device, ":")
327+
switch len(arr) {
328+
case 3:
329+
permissions = arr[2]
330+
fallthrough
331+
case 2:
332+
if validDeviceMode(arr[1]) {
333+
permissions = arr[1]
334+
} else {
335+
dst = arr[1]
336+
}
337+
fallthrough
338+
case 1:
339+
src = arr[0]
340+
default:
341+
return container.DeviceMapping{}, fmt.Errorf("invalid device specification: %s", device)
342+
}
343+
344+
if dst == "" {
345+
dst = src
346+
}
347+
348+
deviceMapping := container.DeviceMapping{
349+
PathOnHost: src,
350+
PathInContainer: dst,
351+
CgroupPermissions: permissions,
352+
}
353+
return deviceMapping, nil
354+
}
355+
356+
// validDeviceMode checks if the mode for device is valid or not.
357+
// Valid mode is a composition of r (read), w (write), and m (mknod).
358+
func validDeviceMode(mode string) bool {
359+
var legalDeviceMode = map[rune]bool{
360+
'r': true,
361+
'w': true,
362+
'm': true,
363+
}
364+
if mode == "" {
365+
return false
366+
}
367+
for _, c := range mode {
368+
if !legalDeviceMode[c] {
369+
return false
370+
}
371+
legalDeviceMode[c] = false
372+
}
373+
return true
374+
}

docker/service/name.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,8 @@ func NewNamer(ctx context.Context, client client.ContainerAPIClient, project, se
5454
}
5555

5656
containers, err := client.ContainerList(ctx, types.ContainerListOptions{
57-
All: true,
58-
Filter: filter,
57+
All: true,
58+
Filters: filter,
5959
})
6060
if err != nil {
6161
return nil, err

0 commit comments

Comments
 (0)