mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
Merge pull request #19068 from calavera/vendor_engine_api
Introduce the new engine-api library.
This commit is contained in:
commit
131e2bf12b
227 changed files with 545 additions and 1017 deletions
|
@ -5,10 +5,10 @@ import (
|
|||
"io"
|
||||
|
||||
"github.com/Sirupsen/logrus"
|
||||
"github.com/docker/docker/api/types"
|
||||
Cli "github.com/docker/docker/cli"
|
||||
flag "github.com/docker/docker/pkg/mflag"
|
||||
"github.com/docker/docker/pkg/signal"
|
||||
"github.com/docker/engine-api/types"
|
||||
)
|
||||
|
||||
// CmdAttach attaches to a running container.
|
||||
|
|
|
@ -15,8 +15,6 @@ import (
|
|||
"strings"
|
||||
|
||||
"github.com/docker/docker/api"
|
||||
"github.com/docker/docker/api/types"
|
||||
"github.com/docker/docker/api/types/container"
|
||||
"github.com/docker/docker/builder/dockerignore"
|
||||
Cli "github.com/docker/docker/cli"
|
||||
"github.com/docker/docker/opts"
|
||||
|
@ -31,6 +29,8 @@ import (
|
|||
"github.com/docker/docker/pkg/urlutil"
|
||||
"github.com/docker/docker/reference"
|
||||
runconfigopts "github.com/docker/docker/runconfig/opts"
|
||||
"github.com/docker/engine-api/types"
|
||||
"github.com/docker/engine-api/types/container"
|
||||
"github.com/docker/go-units"
|
||||
)
|
||||
|
||||
|
|
|
@ -9,12 +9,12 @@ import (
|
|||
"runtime"
|
||||
|
||||
"github.com/docker/docker/api"
|
||||
"github.com/docker/docker/api/client/lib"
|
||||
"github.com/docker/docker/cli"
|
||||
"github.com/docker/docker/cliconfig"
|
||||
"github.com/docker/docker/dockerversion"
|
||||
"github.com/docker/docker/opts"
|
||||
"github.com/docker/docker/pkg/term"
|
||||
"github.com/docker/engine-api/client"
|
||||
"github.com/docker/go-connections/tlsconfig"
|
||||
)
|
||||
|
||||
|
@ -120,7 +120,7 @@ func NewDockerCli(in io.ReadCloser, out, err io.Writer, clientFlags *cli.ClientF
|
|||
return err
|
||||
}
|
||||
|
||||
client, err := lib.NewClient(host, verStr, clientTransport, customHeaders)
|
||||
client, err := client.NewClient(host, verStr, clientTransport, customHeaders)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
|
|
@ -7,11 +7,11 @@ package client
|
|||
import (
|
||||
"io"
|
||||
|
||||
"github.com/docker/docker/api/client/lib"
|
||||
"github.com/docker/docker/api/types"
|
||||
"github.com/docker/docker/api/types/container"
|
||||
"github.com/docker/docker/api/types/filters"
|
||||
"github.com/docker/docker/api/types/registry"
|
||||
"github.com/docker/engine-api/client"
|
||||
"github.com/docker/engine-api/types"
|
||||
"github.com/docker/engine-api/types/container"
|
||||
"github.com/docker/engine-api/types/filters"
|
||||
"github.com/docker/engine-api/types/registry"
|
||||
)
|
||||
|
||||
// apiClient is an interface that clients that talk with a docker server must implement.
|
||||
|
@ -55,10 +55,10 @@ type apiClient interface {
|
|||
ImageInspectWithRaw(imageID string, getSize bool) (types.ImageInspect, []byte, error)
|
||||
ImageList(options types.ImageListOptions) ([]types.Image, error)
|
||||
ImageLoad(input io.Reader) (types.ImageLoadResponse, error)
|
||||
ImagePull(options types.ImagePullOptions, privilegeFunc lib.RequestPrivilegeFunc) (io.ReadCloser, error)
|
||||
ImagePush(options types.ImagePushOptions, privilegeFunc lib.RequestPrivilegeFunc) (io.ReadCloser, error)
|
||||
ImagePull(options types.ImagePullOptions, privilegeFunc client.RequestPrivilegeFunc) (io.ReadCloser, error)
|
||||
ImagePush(options types.ImagePushOptions, privilegeFunc client.RequestPrivilegeFunc) (io.ReadCloser, error)
|
||||
ImageRemove(options types.ImageRemoveOptions) ([]types.ImageDelete, error)
|
||||
ImageSearch(options types.ImageSearchOptions, privilegeFunc lib.RequestPrivilegeFunc) ([]registry.SearchResult, error)
|
||||
ImageSearch(options types.ImageSearchOptions, privilegeFunc client.RequestPrivilegeFunc) ([]registry.SearchResult, error)
|
||||
ImageSave(imageIDs []string) (io.ReadCloser, error)
|
||||
ImageTag(options types.ImageTagOptions) error
|
||||
Info() (types.Info, error)
|
||||
|
|
|
@ -5,12 +5,12 @@ import (
|
|||
"errors"
|
||||
"fmt"
|
||||
|
||||
"github.com/docker/docker/api/types"
|
||||
"github.com/docker/docker/api/types/container"
|
||||
Cli "github.com/docker/docker/cli"
|
||||
"github.com/docker/docker/opts"
|
||||
flag "github.com/docker/docker/pkg/mflag"
|
||||
"github.com/docker/docker/reference"
|
||||
"github.com/docker/engine-api/types"
|
||||
"github.com/docker/engine-api/types/container"
|
||||
)
|
||||
|
||||
// CmdCommit creates a new image from a container's changes.
|
||||
|
|
|
@ -7,11 +7,11 @@ import (
|
|||
"path/filepath"
|
||||
"strings"
|
||||
|
||||
"github.com/docker/docker/api/types"
|
||||
Cli "github.com/docker/docker/cli"
|
||||
"github.com/docker/docker/pkg/archive"
|
||||
flag "github.com/docker/docker/pkg/mflag"
|
||||
"github.com/docker/docker/pkg/system"
|
||||
"github.com/docker/engine-api/types"
|
||||
)
|
||||
|
||||
type copyDirection int
|
||||
|
|
|
@ -5,14 +5,14 @@ import (
|
|||
"io"
|
||||
"os"
|
||||
|
||||
"github.com/docker/docker/api/client/lib"
|
||||
"github.com/docker/docker/api/types"
|
||||
"github.com/docker/docker/api/types/container"
|
||||
Cli "github.com/docker/docker/cli"
|
||||
"github.com/docker/docker/pkg/jsonmessage"
|
||||
"github.com/docker/docker/reference"
|
||||
"github.com/docker/docker/registry"
|
||||
runconfigopts "github.com/docker/docker/runconfig/opts"
|
||||
"github.com/docker/engine-api/client"
|
||||
"github.com/docker/engine-api/types"
|
||||
"github.com/docker/engine-api/types/container"
|
||||
)
|
||||
|
||||
func (cli *DockerCli) pullImage(image string) error {
|
||||
|
@ -110,7 +110,7 @@ func (cli *DockerCli) createContainer(config *container.Config, hostConfig *cont
|
|||
response, err := cli.client.ContainerCreate(config, hostConfig, name)
|
||||
//if image not found try to pull it
|
||||
if err != nil {
|
||||
if lib.IsErrImageNotFound(err) {
|
||||
if client.IsErrImageNotFound(err) {
|
||||
fmt.Fprintf(cli.err, "Unable to find image '%s' locally\n", ref.String())
|
||||
|
||||
// we don't want to write to stdout anything apart from container.ID
|
||||
|
|
|
@ -7,13 +7,13 @@ import (
|
|||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/docker/docker/api/types"
|
||||
eventtypes "github.com/docker/docker/api/types/events"
|
||||
"github.com/docker/docker/api/types/filters"
|
||||
Cli "github.com/docker/docker/cli"
|
||||
"github.com/docker/docker/opts"
|
||||
"github.com/docker/docker/pkg/jsonlog"
|
||||
flag "github.com/docker/docker/pkg/mflag"
|
||||
"github.com/docker/engine-api/types"
|
||||
eventtypes "github.com/docker/engine-api/types/events"
|
||||
"github.com/docker/engine-api/types/filters"
|
||||
)
|
||||
|
||||
// CmdEvents prints a live stream of real time events from the server.
|
||||
|
|
|
@ -5,10 +5,10 @@ import (
|
|||
"io"
|
||||
|
||||
"github.com/Sirupsen/logrus"
|
||||
"github.com/docker/docker/api/types"
|
||||
Cli "github.com/docker/docker/cli"
|
||||
flag "github.com/docker/docker/pkg/mflag"
|
||||
"github.com/docker/docker/pkg/promise"
|
||||
"github.com/docker/engine-api/types"
|
||||
)
|
||||
|
||||
// CmdExec runs a command in a running container.
|
||||
|
|
|
@ -5,8 +5,8 @@ import (
|
|||
"io/ioutil"
|
||||
"testing"
|
||||
|
||||
"github.com/docker/docker/api/types"
|
||||
flag "github.com/docker/docker/pkg/mflag"
|
||||
"github.com/docker/engine-api/types"
|
||||
)
|
||||
|
||||
type arguments struct {
|
||||
|
|
|
@ -7,9 +7,9 @@ import (
|
|||
"time"
|
||||
|
||||
"github.com/docker/docker/api"
|
||||
"github.com/docker/docker/api/types"
|
||||
"github.com/docker/docker/pkg/stringid"
|
||||
"github.com/docker/docker/pkg/stringutils"
|
||||
"github.com/docker/engine-api/types"
|
||||
"github.com/docker/go-units"
|
||||
)
|
||||
|
||||
|
|
|
@ -6,8 +6,8 @@ import (
|
|||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/docker/docker/api/types"
|
||||
"github.com/docker/docker/pkg/stringid"
|
||||
"github.com/docker/engine-api/types"
|
||||
)
|
||||
|
||||
func TestContainerPsContext(t *testing.T) {
|
||||
|
|
|
@ -8,8 +8,8 @@ import (
|
|||
"text/tabwriter"
|
||||
"text/template"
|
||||
|
||||
"github.com/docker/docker/api/types"
|
||||
"github.com/docker/docker/reference"
|
||||
"github.com/docker/engine-api/types"
|
||||
)
|
||||
|
||||
const (
|
||||
|
|
|
@ -6,7 +6,7 @@ import (
|
|||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/docker/docker/api/types"
|
||||
"github.com/docker/engine-api/types"
|
||||
)
|
||||
|
||||
func TestContainerContextWrite(t *testing.T) {
|
||||
|
|
|
@ -5,9 +5,9 @@ import (
|
|||
"os"
|
||||
|
||||
"github.com/Sirupsen/logrus"
|
||||
"github.com/docker/docker/api/types"
|
||||
"github.com/docker/docker/pkg/stdcopy"
|
||||
"github.com/docker/docker/pkg/term"
|
||||
"github.com/docker/engine-api/types"
|
||||
)
|
||||
|
||||
func (cli *DockerCli) holdHijackedConnection(setRawTerminal bool, inputStream io.ReadCloser, outputStream, errorStream io.Writer, resp types.HijackedResponse) error {
|
||||
|
|
|
@ -2,11 +2,11 @@ package client
|
|||
|
||||
import (
|
||||
"github.com/docker/docker/api/client/formatter"
|
||||
"github.com/docker/docker/api/types"
|
||||
"github.com/docker/docker/api/types/filters"
|
||||
Cli "github.com/docker/docker/cli"
|
||||
"github.com/docker/docker/opts"
|
||||
flag "github.com/docker/docker/pkg/mflag"
|
||||
"github.com/docker/engine-api/types"
|
||||
"github.com/docker/engine-api/types/filters"
|
||||
)
|
||||
|
||||
// CmdImages lists the images in a specified repository, or all top-level images if no repository is specified.
|
||||
|
|
|
@ -5,13 +5,13 @@ import (
|
|||
"io"
|
||||
"os"
|
||||
|
||||
"github.com/docker/docker/api/types"
|
||||
Cli "github.com/docker/docker/cli"
|
||||
"github.com/docker/docker/opts"
|
||||
"github.com/docker/docker/pkg/jsonmessage"
|
||||
flag "github.com/docker/docker/pkg/mflag"
|
||||
"github.com/docker/docker/pkg/urlutil"
|
||||
"github.com/docker/docker/reference"
|
||||
"github.com/docker/engine-api/types"
|
||||
)
|
||||
|
||||
// CmdImport creates an empty filesystem image, imports the contents of the tarball into the image, and optionally tags the image.
|
||||
|
|
|
@ -6,9 +6,9 @@ import (
|
|||
"text/template"
|
||||
|
||||
"github.com/docker/docker/api/client/inspect"
|
||||
"github.com/docker/docker/api/client/lib"
|
||||
Cli "github.com/docker/docker/cli"
|
||||
flag "github.com/docker/docker/pkg/mflag"
|
||||
"github.com/docker/engine-api/client"
|
||||
)
|
||||
|
||||
var funcMap = template.FuncMap{
|
||||
|
@ -64,10 +64,10 @@ func (cli *DockerCli) inspectAll(getSize bool) inspectSearcher {
|
|||
c, rawContainer, err := cli.client.ContainerInspectWithRaw(ref, getSize)
|
||||
if err != nil {
|
||||
// Search for image with that id if a container doesn't exist.
|
||||
if lib.IsErrContainerNotFound(err) {
|
||||
if client.IsErrContainerNotFound(err) {
|
||||
i, rawImage, err := cli.client.ImageInspectWithRaw(ref, getSize)
|
||||
if err != nil {
|
||||
if lib.IsErrImageNotFound(err) {
|
||||
if client.IsErrImageNotFound(err) {
|
||||
return nil, nil, fmt.Errorf("Error: No such image or container: %s", ref)
|
||||
}
|
||||
return nil, nil, err
|
||||
|
|
|
@ -1,36 +0,0 @@
|
|||
package lib
|
||||
|
||||
import (
|
||||
"net/url"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestGetAPIPath(t *testing.T) {
|
||||
cases := []struct {
|
||||
v string
|
||||
p string
|
||||
q url.Values
|
||||
e string
|
||||
}{
|
||||
{"", "/containers/json", nil, "/containers/json"},
|
||||
{"", "/containers/json", url.Values{}, "/containers/json"},
|
||||
{"", "/containers/json", url.Values{"s": []string{"c"}}, "/containers/json?s=c"},
|
||||
{"1.22", "/containers/json", nil, "/v1.22/containers/json"},
|
||||
{"1.22", "/containers/json", url.Values{}, "/v1.22/containers/json"},
|
||||
{"1.22", "/containers/json", url.Values{"s": []string{"c"}}, "/v1.22/containers/json?s=c"},
|
||||
{"v1.22", "/containers/json", nil, "/v1.22/containers/json"},
|
||||
{"v1.22", "/containers/json", url.Values{}, "/v1.22/containers/json"},
|
||||
{"v1.22", "/containers/json", url.Values{"s": []string{"c"}}, "/v1.22/containers/json?s=c"},
|
||||
}
|
||||
|
||||
for _, cs := range cases {
|
||||
c, err := NewClient("unix:///var/run/docker.sock", cs.v, nil, nil)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
g := c.getAPIPath(cs.p, cs.q)
|
||||
if g != cs.e {
|
||||
t.Fatalf("Expected %s, got %s", cs.e, g)
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,17 +0,0 @@
|
|||
package lib
|
||||
|
||||
import "testing"
|
||||
|
||||
func TestGetDockerOS(t *testing.T) {
|
||||
cases := map[string]string{
|
||||
"Docker/v1.22 (linux)": "linux",
|
||||
"Docker/v1.22 (windows)": "windows",
|
||||
"Foo/v1.22 (bar)": "",
|
||||
}
|
||||
for header, os := range cases {
|
||||
g := getDockerOS(header)
|
||||
if g != os {
|
||||
t.Fatalf("Expected %s, got %s", os, g)
|
||||
}
|
||||
}
|
||||
}
|
|
@ -8,12 +8,12 @@ import (
|
|||
"runtime"
|
||||
"strings"
|
||||
|
||||
"github.com/docker/docker/api/client/lib"
|
||||
"github.com/docker/docker/api/types"
|
||||
Cli "github.com/docker/docker/cli"
|
||||
flag "github.com/docker/docker/pkg/mflag"
|
||||
"github.com/docker/docker/pkg/term"
|
||||
"github.com/docker/docker/registry"
|
||||
"github.com/docker/engine-api/client"
|
||||
"github.com/docker/engine-api/types"
|
||||
)
|
||||
|
||||
// CmdLogin logs in or registers a user to a Docker registry service.
|
||||
|
@ -122,7 +122,7 @@ func (cli *DockerCli) CmdLogin(args ...string) error {
|
|||
auth := cli.configFile.AuthConfigs[serverAddress]
|
||||
response, err := cli.client.RegistryLogin(auth)
|
||||
if err != nil {
|
||||
if lib.IsErrUnauthorized(err) {
|
||||
if client.IsErrUnauthorized(err) {
|
||||
delete(cli.configFile.AuthConfigs, serverAddress)
|
||||
if err2 := cli.configFile.Save(); err2 != nil {
|
||||
fmt.Fprintf(cli.out, "WARNING: could not save config file: %v\n", err2)
|
||||
|
|
|
@ -4,10 +4,10 @@ import (
|
|||
"fmt"
|
||||
"io"
|
||||
|
||||
"github.com/docker/docker/api/types"
|
||||
Cli "github.com/docker/docker/cli"
|
||||
flag "github.com/docker/docker/pkg/mflag"
|
||||
"github.com/docker/docker/pkg/stdcopy"
|
||||
"github.com/docker/engine-api/types"
|
||||
)
|
||||
|
||||
var validDrivers = map[string]bool{
|
||||
|
|
|
@ -6,13 +6,13 @@ import (
|
|||
"strings"
|
||||
"text/tabwriter"
|
||||
|
||||
"github.com/docker/docker/api/types"
|
||||
"github.com/docker/docker/api/types/filters"
|
||||
"github.com/docker/docker/api/types/network"
|
||||
Cli "github.com/docker/docker/cli"
|
||||
"github.com/docker/docker/opts"
|
||||
flag "github.com/docker/docker/pkg/mflag"
|
||||
"github.com/docker/docker/pkg/stringid"
|
||||
"github.com/docker/engine-api/types"
|
||||
"github.com/docker/engine-api/types/filters"
|
||||
"github.com/docker/engine-api/types/network"
|
||||
)
|
||||
|
||||
// CmdNetwork is the parent subcommand for all network commands
|
||||
|
|
|
@ -2,11 +2,11 @@ package client
|
|||
|
||||
import (
|
||||
"github.com/docker/docker/api/client/formatter"
|
||||
"github.com/docker/docker/api/types"
|
||||
"github.com/docker/docker/api/types/filters"
|
||||
Cli "github.com/docker/docker/cli"
|
||||
"github.com/docker/docker/opts"
|
||||
flag "github.com/docker/docker/pkg/mflag"
|
||||
"github.com/docker/engine-api/types"
|
||||
"github.com/docker/engine-api/types/filters"
|
||||
)
|
||||
|
||||
// CmdPs outputs a list of Docker containers.
|
||||
|
|
|
@ -4,13 +4,13 @@ import (
|
|||
"errors"
|
||||
"fmt"
|
||||
|
||||
"github.com/docker/docker/api/client/lib"
|
||||
"github.com/docker/docker/api/types"
|
||||
Cli "github.com/docker/docker/cli"
|
||||
"github.com/docker/docker/pkg/jsonmessage"
|
||||
flag "github.com/docker/docker/pkg/mflag"
|
||||
"github.com/docker/docker/reference"
|
||||
"github.com/docker/docker/registry"
|
||||
"github.com/docker/engine-api/client"
|
||||
"github.com/docker/engine-api/types"
|
||||
)
|
||||
|
||||
// CmdPull pulls an image or a repository from the registry.
|
||||
|
@ -65,7 +65,7 @@ func (cli *DockerCli) CmdPull(args ...string) error {
|
|||
return cli.imagePullPrivileged(authConfig, distributionRef.String(), "", requestPrivilege)
|
||||
}
|
||||
|
||||
func (cli *DockerCli) imagePullPrivileged(authConfig types.AuthConfig, imageID, tag string, requestPrivilege lib.RequestPrivilegeFunc) error {
|
||||
func (cli *DockerCli) imagePullPrivileged(authConfig types.AuthConfig, imageID, tag string, requestPrivilege client.RequestPrivilegeFunc) error {
|
||||
|
||||
encodedAuth, err := encodeAuthToBase64(authConfig)
|
||||
if err != nil {
|
||||
|
|
|
@ -4,13 +4,13 @@ import (
|
|||
"errors"
|
||||
"io"
|
||||
|
||||
"github.com/docker/docker/api/client/lib"
|
||||
"github.com/docker/docker/api/types"
|
||||
Cli "github.com/docker/docker/cli"
|
||||
"github.com/docker/docker/pkg/jsonmessage"
|
||||
flag "github.com/docker/docker/pkg/mflag"
|
||||
"github.com/docker/docker/reference"
|
||||
"github.com/docker/docker/registry"
|
||||
"github.com/docker/engine-api/client"
|
||||
"github.com/docker/engine-api/types"
|
||||
)
|
||||
|
||||
// CmdPush pushes an image or repository to the registry.
|
||||
|
@ -52,7 +52,7 @@ func (cli *DockerCli) CmdPush(args ...string) error {
|
|||
return cli.imagePushPrivileged(authConfig, ref.Name(), tag, cli.out, requestPrivilege)
|
||||
}
|
||||
|
||||
func (cli *DockerCli) imagePushPrivileged(authConfig types.AuthConfig, imageID, tag string, outputStream io.Writer, requestPrivilege lib.RequestPrivilegeFunc) error {
|
||||
func (cli *DockerCli) imagePushPrivileged(authConfig types.AuthConfig, imageID, tag string, outputStream io.Writer, requestPrivilege client.RequestPrivilegeFunc) error {
|
||||
encodedAuth, err := encodeAuthToBase64(authConfig)
|
||||
if err != nil {
|
||||
return err
|
||||
|
|
|
@ -4,9 +4,9 @@ import (
|
|||
"fmt"
|
||||
"strings"
|
||||
|
||||
"github.com/docker/docker/api/types"
|
||||
Cli "github.com/docker/docker/cli"
|
||||
flag "github.com/docker/docker/pkg/mflag"
|
||||
"github.com/docker/engine-api/types"
|
||||
)
|
||||
|
||||
// CmdRm removes one or more containers.
|
||||
|
|
|
@ -4,9 +4,9 @@ import (
|
|||
"fmt"
|
||||
"net/url"
|
||||
|
||||
"github.com/docker/docker/api/types"
|
||||
Cli "github.com/docker/docker/cli"
|
||||
flag "github.com/docker/docker/pkg/mflag"
|
||||
"github.com/docker/engine-api/types"
|
||||
)
|
||||
|
||||
// CmdRmi removes all images with the specified name(s).
|
||||
|
|
|
@ -8,13 +8,13 @@ import (
|
|||
"strings"
|
||||
|
||||
"github.com/Sirupsen/logrus"
|
||||
"github.com/docker/docker/api/types"
|
||||
Cli "github.com/docker/docker/cli"
|
||||
derr "github.com/docker/docker/errors"
|
||||
"github.com/docker/docker/opts"
|
||||
"github.com/docker/docker/pkg/promise"
|
||||
"github.com/docker/docker/pkg/signal"
|
||||
runconfigopts "github.com/docker/docker/runconfig/opts"
|
||||
"github.com/docker/engine-api/types"
|
||||
"github.com/docker/libnetwork/resolvconf/dns"
|
||||
)
|
||||
|
||||
|
|
|
@ -7,12 +7,12 @@ import (
|
|||
"strings"
|
||||
"text/tabwriter"
|
||||
|
||||
"github.com/docker/docker/api/types"
|
||||
registrytypes "github.com/docker/docker/api/types/registry"
|
||||
Cli "github.com/docker/docker/cli"
|
||||
flag "github.com/docker/docker/pkg/mflag"
|
||||
"github.com/docker/docker/pkg/stringutils"
|
||||
"github.com/docker/docker/registry"
|
||||
"github.com/docker/engine-api/types"
|
||||
registrytypes "github.com/docker/engine-api/types/registry"
|
||||
)
|
||||
|
||||
// CmdSearch searches the Docker Hub for images.
|
||||
|
|
|
@ -7,11 +7,11 @@ import (
|
|||
"strings"
|
||||
|
||||
"github.com/Sirupsen/logrus"
|
||||
"github.com/docker/docker/api/types"
|
||||
Cli "github.com/docker/docker/cli"
|
||||
flag "github.com/docker/docker/pkg/mflag"
|
||||
"github.com/docker/docker/pkg/promise"
|
||||
"github.com/docker/docker/pkg/signal"
|
||||
"github.com/docker/engine-api/types"
|
||||
)
|
||||
|
||||
func (cli *DockerCli) forwardAllSignals(cid string) chan os.Signal {
|
||||
|
|
|
@ -10,10 +10,10 @@ import (
|
|||
"text/tabwriter"
|
||||
"time"
|
||||
|
||||
"github.com/docker/docker/api/types"
|
||||
"github.com/docker/docker/api/types/events"
|
||||
"github.com/docker/docker/api/types/filters"
|
||||
Cli "github.com/docker/docker/cli"
|
||||
"github.com/docker/engine-api/types"
|
||||
"github.com/docker/engine-api/types/events"
|
||||
"github.com/docker/engine-api/types/filters"
|
||||
"github.com/docker/go-units"
|
||||
)
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@ import (
|
|||
"sync"
|
||||
"testing"
|
||||
|
||||
"github.com/docker/docker/api/types"
|
||||
"github.com/docker/engine-api/types"
|
||||
)
|
||||
|
||||
func TestDisplay(t *testing.T) {
|
||||
|
|
|
@ -3,10 +3,10 @@ package client
|
|||
import (
|
||||
"errors"
|
||||
|
||||
"github.com/docker/docker/api/types"
|
||||
Cli "github.com/docker/docker/cli"
|
||||
flag "github.com/docker/docker/pkg/mflag"
|
||||
"github.com/docker/docker/reference"
|
||||
"github.com/docker/engine-api/types"
|
||||
)
|
||||
|
||||
// CmdTag tags an image into a repository.
|
||||
|
|
|
@ -21,15 +21,15 @@ import (
|
|||
"github.com/docker/distribution/digest"
|
||||
"github.com/docker/distribution/registry/client/auth"
|
||||
"github.com/docker/distribution/registry/client/transport"
|
||||
"github.com/docker/docker/api/client/lib"
|
||||
"github.com/docker/docker/api/types"
|
||||
registrytypes "github.com/docker/docker/api/types/registry"
|
||||
"github.com/docker/docker/cliconfig"
|
||||
"github.com/docker/docker/pkg/ansiescape"
|
||||
"github.com/docker/docker/pkg/ioutils"
|
||||
flag "github.com/docker/docker/pkg/mflag"
|
||||
"github.com/docker/docker/reference"
|
||||
"github.com/docker/docker/registry"
|
||||
apiclient "github.com/docker/engine-api/client"
|
||||
"github.com/docker/engine-api/types"
|
||||
registrytypes "github.com/docker/engine-api/types/registry"
|
||||
"github.com/docker/go-connections/tlsconfig"
|
||||
"github.com/docker/notary/client"
|
||||
"github.com/docker/notary/passphrase"
|
||||
|
@ -280,7 +280,7 @@ func notaryError(err error) error {
|
|||
return err
|
||||
}
|
||||
|
||||
func (cli *DockerCli) trustedPull(repoInfo *registry.RepositoryInfo, ref registry.Reference, authConfig types.AuthConfig, requestPrivilege lib.RequestPrivilegeFunc) error {
|
||||
func (cli *DockerCli) trustedPull(repoInfo *registry.RepositoryInfo, ref registry.Reference, authConfig types.AuthConfig, requestPrivilege apiclient.RequestPrivilegeFunc) error {
|
||||
var refs []target
|
||||
|
||||
notaryRepo, err := cli.getNotaryRepository(repoInfo, authConfig)
|
||||
|
@ -383,7 +383,7 @@ func targetStream(in io.Writer) (io.WriteCloser, <-chan []target) {
|
|||
return ioutils.NewWriteCloserWrapper(out, w.Close), targetChan
|
||||
}
|
||||
|
||||
func (cli *DockerCli) trustedPush(repoInfo *registry.RepositoryInfo, tag string, authConfig types.AuthConfig, requestPrivilege lib.RequestPrivilegeFunc) error {
|
||||
func (cli *DockerCli) trustedPush(repoInfo *registry.RepositoryInfo, tag string, authConfig types.AuthConfig, requestPrivilege apiclient.RequestPrivilegeFunc) error {
|
||||
streamOut, targetChan := targetStream(cli.out)
|
||||
|
||||
reqError := cli.imagePushPrivileged(authConfig, repoInfo.Name(), tag, streamOut, requestPrivilege)
|
||||
|
|
|
@ -4,8 +4,8 @@ import (
|
|||
"os"
|
||||
"testing"
|
||||
|
||||
registrytypes "github.com/docker/docker/api/types/registry"
|
||||
"github.com/docker/docker/registry"
|
||||
registrytypes "github.com/docker/engine-api/types/registry"
|
||||
)
|
||||
|
||||
func unsetENV() {
|
||||
|
|
|
@ -3,9 +3,9 @@ package client
|
|||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/docker/docker/api/types/container"
|
||||
Cli "github.com/docker/docker/cli"
|
||||
flag "github.com/docker/docker/pkg/mflag"
|
||||
"github.com/docker/engine-api/types/container"
|
||||
"github.com/docker/go-units"
|
||||
)
|
||||
|
||||
|
|
|
@ -10,12 +10,12 @@ import (
|
|||
"time"
|
||||
|
||||
"github.com/Sirupsen/logrus"
|
||||
"github.com/docker/docker/api/client/lib"
|
||||
"github.com/docker/docker/api/types"
|
||||
registrytypes "github.com/docker/docker/api/types/registry"
|
||||
"github.com/docker/docker/pkg/signal"
|
||||
"github.com/docker/docker/pkg/term"
|
||||
"github.com/docker/docker/registry"
|
||||
"github.com/docker/engine-api/client"
|
||||
"github.com/docker/engine-api/types"
|
||||
registrytypes "github.com/docker/engine-api/types/registry"
|
||||
)
|
||||
|
||||
// encodeAuthToBase64 serializes the auth configuration as JSON base64 payload
|
||||
|
@ -32,7 +32,7 @@ func (cli *DockerCli) encodeRegistryAuth(index *registrytypes.IndexInfo) (string
|
|||
return encodeAuthToBase64(authConfig)
|
||||
}
|
||||
|
||||
func (cli *DockerCli) registryAuthenticationPrivilegedFunc(index *registrytypes.IndexInfo, cmdName string) lib.RequestPrivilegeFunc {
|
||||
func (cli *DockerCli) registryAuthenticationPrivilegedFunc(index *registrytypes.IndexInfo, cmdName string) client.RequestPrivilegeFunc {
|
||||
return func() (string, error) {
|
||||
fmt.Fprintf(cli.out, "\nPlease login prior to %s:\n", cmdName)
|
||||
if err := cli.CmdLogin(registry.GetAuthConfigKey(index)); err != nil {
|
||||
|
@ -72,7 +72,7 @@ func getExitCode(cli *DockerCli, containerID string) (bool, int, error) {
|
|||
c, err := cli.client.ContainerInspect(containerID)
|
||||
if err != nil {
|
||||
// If we can't connect, then the daemon probably died.
|
||||
if err != lib.ErrConnectionFailed {
|
||||
if err != client.ErrConnectionFailed {
|
||||
return false, -1, err
|
||||
}
|
||||
return false, -1, nil
|
||||
|
@ -87,7 +87,7 @@ func getExecExitCode(cli *DockerCli, execID string) (bool, int, error) {
|
|||
resp, err := cli.client.ContainerExecInspect(execID)
|
||||
if err != nil {
|
||||
// If we can't connect, then the daemon probably died.
|
||||
if err != lib.ErrConnectionFailed {
|
||||
if err != client.ErrConnectionFailed {
|
||||
return false, -1, err
|
||||
}
|
||||
return false, -1, nil
|
||||
|
|
|
@ -5,11 +5,11 @@ import (
|
|||
"text/template"
|
||||
"time"
|
||||
|
||||
"github.com/docker/docker/api/types"
|
||||
Cli "github.com/docker/docker/cli"
|
||||
"github.com/docker/docker/dockerversion"
|
||||
flag "github.com/docker/docker/pkg/mflag"
|
||||
"github.com/docker/docker/utils"
|
||||
"github.com/docker/engine-api/types"
|
||||
)
|
||||
|
||||
var versionTemplate = `Client:
|
||||
|
|
|
@ -4,11 +4,11 @@ import (
|
|||
"fmt"
|
||||
"text/tabwriter"
|
||||
|
||||
"github.com/docker/docker/api/types"
|
||||
"github.com/docker/docker/api/types/filters"
|
||||
Cli "github.com/docker/docker/cli"
|
||||
"github.com/docker/docker/opts"
|
||||
flag "github.com/docker/docker/pkg/mflag"
|
||||
"github.com/docker/engine-api/types"
|
||||
"github.com/docker/engine-api/types/filters"
|
||||
)
|
||||
|
||||
// CmdVolume is the parent subcommand for all volume commands
|
||||
|
|
|
@ -9,9 +9,9 @@ import (
|
|||
"strings"
|
||||
|
||||
"github.com/Sirupsen/logrus"
|
||||
"github.com/docker/docker/api/types"
|
||||
"github.com/docker/docker/pkg/system"
|
||||
"github.com/docker/docker/pkg/version"
|
||||
"github.com/docker/engine-api/types"
|
||||
"github.com/docker/libtrust"
|
||||
)
|
||||
|
||||
|
|
|
@ -7,7 +7,7 @@ import (
|
|||
|
||||
"os"
|
||||
|
||||
"github.com/docker/docker/api/types"
|
||||
"github.com/docker/engine-api/types"
|
||||
)
|
||||
|
||||
type ports struct {
|
||||
|
|
|
@ -13,8 +13,6 @@ import (
|
|||
|
||||
"github.com/Sirupsen/logrus"
|
||||
"github.com/docker/docker/api/server/httputils"
|
||||
"github.com/docker/docker/api/types"
|
||||
"github.com/docker/docker/api/types/container"
|
||||
"github.com/docker/docker/builder"
|
||||
"github.com/docker/docker/builder/dockerfile"
|
||||
"github.com/docker/docker/daemon/daemonbuilder"
|
||||
|
@ -25,6 +23,8 @@ import (
|
|||
"github.com/docker/docker/pkg/streamformatter"
|
||||
"github.com/docker/docker/reference"
|
||||
"github.com/docker/docker/utils"
|
||||
"github.com/docker/engine-api/types"
|
||||
"github.com/docker/engine-api/types/container"
|
||||
"github.com/docker/go-units"
|
||||
"golang.org/x/net/context"
|
||||
)
|
||||
|
|
|
@ -4,12 +4,12 @@ import (
|
|||
"io"
|
||||
"time"
|
||||
|
||||
"github.com/docker/docker/api/types"
|
||||
"github.com/docker/docker/api/types/container"
|
||||
"github.com/docker/docker/daemon"
|
||||
"github.com/docker/docker/daemon/exec"
|
||||
"github.com/docker/docker/pkg/archive"
|
||||
"github.com/docker/docker/pkg/version"
|
||||
"github.com/docker/engine-api/types"
|
||||
"github.com/docker/engine-api/types/container"
|
||||
)
|
||||
|
||||
// execBackend includes functions to implement to provide exec functionality.
|
||||
|
|
|
@ -12,9 +12,6 @@ import (
|
|||
"github.com/Sirupsen/logrus"
|
||||
"github.com/docker/distribution/registry/api/errcode"
|
||||
"github.com/docker/docker/api/server/httputils"
|
||||
"github.com/docker/docker/api/types"
|
||||
"github.com/docker/docker/api/types/container"
|
||||
timetypes "github.com/docker/docker/api/types/time"
|
||||
"github.com/docker/docker/daemon"
|
||||
derr "github.com/docker/docker/errors"
|
||||
"github.com/docker/docker/pkg/ioutils"
|
||||
|
@ -22,6 +19,9 @@ import (
|
|||
"github.com/docker/docker/pkg/term"
|
||||
"github.com/docker/docker/runconfig"
|
||||
"github.com/docker/docker/utils"
|
||||
"github.com/docker/engine-api/types"
|
||||
"github.com/docker/engine-api/types/container"
|
||||
timetypes "github.com/docker/engine-api/types/time"
|
||||
"golang.org/x/net/context"
|
||||
"golang.org/x/net/websocket"
|
||||
)
|
||||
|
|
|
@ -10,7 +10,7 @@ import (
|
|||
"strings"
|
||||
|
||||
"github.com/docker/docker/api/server/httputils"
|
||||
"github.com/docker/docker/api/types"
|
||||
"github.com/docker/engine-api/types"
|
||||
"golang.org/x/net/context"
|
||||
)
|
||||
|
||||
|
|
|
@ -9,9 +9,9 @@ import (
|
|||
|
||||
"github.com/Sirupsen/logrus"
|
||||
"github.com/docker/docker/api/server/httputils"
|
||||
"github.com/docker/docker/api/types"
|
||||
"github.com/docker/docker/pkg/stdcopy"
|
||||
"github.com/docker/docker/utils"
|
||||
"github.com/docker/engine-api/types"
|
||||
"golang.org/x/net/context"
|
||||
)
|
||||
|
||||
|
|
|
@ -11,14 +11,14 @@ import (
|
|||
|
||||
"github.com/docker/distribution/digest"
|
||||
"github.com/docker/docker/api/server/httputils"
|
||||
"github.com/docker/docker/api/types"
|
||||
"github.com/docker/docker/api/types/container"
|
||||
"github.com/docker/docker/builder/dockerfile"
|
||||
derr "github.com/docker/docker/errors"
|
||||
"github.com/docker/docker/pkg/ioutils"
|
||||
"github.com/docker/docker/pkg/streamformatter"
|
||||
"github.com/docker/docker/reference"
|
||||
"github.com/docker/docker/runconfig"
|
||||
"github.com/docker/engine-api/types"
|
||||
"github.com/docker/engine-api/types/container"
|
||||
"golang.org/x/net/context"
|
||||
)
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package network
|
||||
|
||||
import (
|
||||
"github.com/docker/docker/api/types/network"
|
||||
"github.com/docker/engine-api/types/network"
|
||||
|
||||
"github.com/docker/libnetwork"
|
||||
)
|
||||
|
|
|
@ -5,8 +5,8 @@ import (
|
|||
"regexp"
|
||||
"strings"
|
||||
|
||||
"github.com/docker/docker/api/types/filters"
|
||||
"github.com/docker/docker/runconfig"
|
||||
"github.com/docker/engine-api/types/filters"
|
||||
"github.com/docker/libnetwork"
|
||||
)
|
||||
|
||||
|
|
|
@ -8,11 +8,11 @@ import (
|
|||
"golang.org/x/net/context"
|
||||
|
||||
"github.com/docker/docker/api/server/httputils"
|
||||
"github.com/docker/docker/api/types"
|
||||
"github.com/docker/docker/api/types/filters"
|
||||
"github.com/docker/docker/api/types/network"
|
||||
"github.com/docker/docker/daemon"
|
||||
"github.com/docker/docker/runconfig"
|
||||
"github.com/docker/engine-api/types"
|
||||
"github.com/docker/engine-api/types/filters"
|
||||
"github.com/docker/engine-api/types/network"
|
||||
"github.com/docker/libnetwork"
|
||||
)
|
||||
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
package system
|
||||
|
||||
import (
|
||||
"github.com/docker/docker/api/types"
|
||||
"github.com/docker/docker/api/types/events"
|
||||
"github.com/docker/docker/api/types/filters"
|
||||
"github.com/docker/engine-api/types"
|
||||
"github.com/docker/engine-api/types/events"
|
||||
"github.com/docker/engine-api/types/filters"
|
||||
)
|
||||
|
||||
// Backend is the methods that need to be implemented to provide
|
||||
|
|
|
@ -8,11 +8,11 @@ import (
|
|||
"github.com/Sirupsen/logrus"
|
||||
"github.com/docker/docker/api"
|
||||
"github.com/docker/docker/api/server/httputils"
|
||||
"github.com/docker/docker/api/types"
|
||||
"github.com/docker/docker/api/types/events"
|
||||
"github.com/docker/docker/api/types/filters"
|
||||
timetypes "github.com/docker/docker/api/types/time"
|
||||
"github.com/docker/docker/pkg/ioutils"
|
||||
"github.com/docker/engine-api/types"
|
||||
"github.com/docker/engine-api/types/events"
|
||||
"github.com/docker/engine-api/types/filters"
|
||||
timetypes "github.com/docker/engine-api/types/time"
|
||||
"golang.org/x/net/context"
|
||||
)
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@ package volume
|
|||
|
||||
import (
|
||||
// TODO return types need to be refactored into pkg
|
||||
"github.com/docker/docker/api/types"
|
||||
"github.com/docker/engine-api/types"
|
||||
)
|
||||
|
||||
// Backend is the methods that need to be implemented to provide
|
||||
|
|
|
@ -5,7 +5,7 @@ import (
|
|||
"net/http"
|
||||
|
||||
"github.com/docker/docker/api/server/httputils"
|
||||
"github.com/docker/docker/api/types"
|
||||
"github.com/docker/engine-api/types"
|
||||
"golang.org/x/net/context"
|
||||
)
|
||||
|
||||
|
|
|
@ -1,369 +0,0 @@
|
|||
package filters
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestParseArgs(t *testing.T) {
|
||||
// equivalent of `docker ps -f 'created=today' -f 'image.name=ubuntu*' -f 'image.name=*untu'`
|
||||
flagArgs := []string{
|
||||
"created=today",
|
||||
"image.name=ubuntu*",
|
||||
"image.name=*untu",
|
||||
}
|
||||
var (
|
||||
args = NewArgs()
|
||||
err error
|
||||
)
|
||||
for i := range flagArgs {
|
||||
args, err = ParseFlag(flagArgs[i], args)
|
||||
if err != nil {
|
||||
t.Errorf("failed to parse %s: %s", flagArgs[i], err)
|
||||
}
|
||||
}
|
||||
if len(args.Get("created")) != 1 {
|
||||
t.Errorf("failed to set this arg")
|
||||
}
|
||||
if len(args.Get("image.name")) != 2 {
|
||||
t.Errorf("the args should have collapsed")
|
||||
}
|
||||
}
|
||||
|
||||
func TestParseArgsEdgeCase(t *testing.T) {
|
||||
var filters Args
|
||||
args, err := ParseFlag("", filters)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if args.Len() != 0 {
|
||||
t.Fatalf("Expected an empty Args (map), got %v", args)
|
||||
}
|
||||
if args, err = ParseFlag("anything", args); err == nil || err != ErrBadFormat {
|
||||
t.Fatalf("Expected ErrBadFormat, got %v", err)
|
||||
}
|
||||
}
|
||||
|
||||
func TestToParam(t *testing.T) {
|
||||
fields := map[string]map[string]bool{
|
||||
"created": {"today": true},
|
||||
"image.name": {"ubuntu*": true, "*untu": true},
|
||||
}
|
||||
a := Args{fields: fields}
|
||||
|
||||
_, err := ToParam(a)
|
||||
if err != nil {
|
||||
t.Errorf("failed to marshal the filters: %s", err)
|
||||
}
|
||||
}
|
||||
|
||||
func TestFromParam(t *testing.T) {
|
||||
invalids := []string{
|
||||
"anything",
|
||||
"['a','list']",
|
||||
"{'key': 'value'}",
|
||||
`{"key": "value"}`,
|
||||
}
|
||||
valid := map[*Args][]string{
|
||||
&Args{fields: map[string]map[string]bool{"key": {"value": true}}}: {
|
||||
`{"key": ["value"]}`,
|
||||
`{"key": {"value": true}}`,
|
||||
},
|
||||
&Args{fields: map[string]map[string]bool{"key": {"value1": true, "value2": true}}}: {
|
||||
`{"key": ["value1", "value2"]}`,
|
||||
`{"key": {"value1": true, "value2": true}}`,
|
||||
},
|
||||
&Args{fields: map[string]map[string]bool{"key1": {"value1": true}, "key2": {"value2": true}}}: {
|
||||
`{"key1": ["value1"], "key2": ["value2"]}`,
|
||||
`{"key1": {"value1": true}, "key2": {"value2": true}}`,
|
||||
},
|
||||
}
|
||||
|
||||
for _, invalid := range invalids {
|
||||
if _, err := FromParam(invalid); err == nil {
|
||||
t.Fatalf("Expected an error with %v, got nothing", invalid)
|
||||
}
|
||||
}
|
||||
|
||||
for expectedArgs, matchers := range valid {
|
||||
for _, json := range matchers {
|
||||
args, err := FromParam(json)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if args.Len() != expectedArgs.Len() {
|
||||
t.Fatalf("Expected %v, go %v", expectedArgs, args)
|
||||
}
|
||||
for key, expectedValues := range expectedArgs.fields {
|
||||
values := args.Get(key)
|
||||
|
||||
if len(values) != len(expectedValues) {
|
||||
t.Fatalf("Expected %v, go %v", expectedArgs, args)
|
||||
}
|
||||
|
||||
for _, v := range values {
|
||||
if !expectedValues[v] {
|
||||
t.Fatalf("Expected %v, go %v", expectedArgs, args)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func TestEmpty(t *testing.T) {
|
||||
a := Args{}
|
||||
v, err := ToParam(a)
|
||||
if err != nil {
|
||||
t.Errorf("failed to marshal the filters: %s", err)
|
||||
}
|
||||
v1, err := FromParam(v)
|
||||
if err != nil {
|
||||
t.Errorf("%s", err)
|
||||
}
|
||||
if a.Len() != v1.Len() {
|
||||
t.Errorf("these should both be empty sets")
|
||||
}
|
||||
}
|
||||
|
||||
func TestArgsMatchKVListEmptySources(t *testing.T) {
|
||||
args := NewArgs()
|
||||
if !args.MatchKVList("created", map[string]string{}) {
|
||||
t.Fatalf("Expected true for (%v,created), got true", args)
|
||||
}
|
||||
|
||||
args = Args{map[string]map[string]bool{"created": {"today": true}}}
|
||||
if args.MatchKVList("created", map[string]string{}) {
|
||||
t.Fatalf("Expected false for (%v,created), got true", args)
|
||||
}
|
||||
}
|
||||
|
||||
func TestArgsMatchKVList(t *testing.T) {
|
||||
// Not empty sources
|
||||
sources := map[string]string{
|
||||
"key1": "value1",
|
||||
"key2": "value2",
|
||||
"key3": "value3",
|
||||
}
|
||||
|
||||
matches := map[*Args]string{
|
||||
&Args{}: "field",
|
||||
&Args{map[string]map[string]bool{
|
||||
"created": map[string]bool{"today": true},
|
||||
"labels": map[string]bool{"key1": true}},
|
||||
}: "labels",
|
||||
&Args{map[string]map[string]bool{
|
||||
"created": map[string]bool{"today": true},
|
||||
"labels": map[string]bool{"key1=value1": true}},
|
||||
}: "labels",
|
||||
}
|
||||
|
||||
for args, field := range matches {
|
||||
if args.MatchKVList(field, sources) != true {
|
||||
t.Fatalf("Expected true for %v on %v, got false", sources, args)
|
||||
}
|
||||
}
|
||||
|
||||
differs := map[*Args]string{
|
||||
&Args{map[string]map[string]bool{
|
||||
"created": map[string]bool{"today": true}},
|
||||
}: "created",
|
||||
&Args{map[string]map[string]bool{
|
||||
"created": map[string]bool{"today": true},
|
||||
"labels": map[string]bool{"key4": true}},
|
||||
}: "labels",
|
||||
&Args{map[string]map[string]bool{
|
||||
"created": map[string]bool{"today": true},
|
||||
"labels": map[string]bool{"key1=value3": true}},
|
||||
}: "labels",
|
||||
}
|
||||
|
||||
for args, field := range differs {
|
||||
if args.MatchKVList(field, sources) != false {
|
||||
t.Fatalf("Expected false for %v on %v, got true", sources, args)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func TestArgsMatch(t *testing.T) {
|
||||
source := "today"
|
||||
|
||||
matches := map[*Args]string{
|
||||
&Args{}: "field",
|
||||
&Args{map[string]map[string]bool{
|
||||
"created": map[string]bool{"today": true}},
|
||||
}: "today",
|
||||
&Args{map[string]map[string]bool{
|
||||
"created": map[string]bool{"to*": true}},
|
||||
}: "created",
|
||||
&Args{map[string]map[string]bool{
|
||||
"created": map[string]bool{"to(.*)": true}},
|
||||
}: "created",
|
||||
&Args{map[string]map[string]bool{
|
||||
"created": map[string]bool{"tod": true}},
|
||||
}: "created",
|
||||
&Args{map[string]map[string]bool{
|
||||
"created": map[string]bool{"anyting": true, "to*": true}},
|
||||
}: "created",
|
||||
}
|
||||
|
||||
for args, field := range matches {
|
||||
if args.Match(field, source) != true {
|
||||
t.Fatalf("Expected true for %v on %v, got false", source, args)
|
||||
}
|
||||
}
|
||||
|
||||
differs := map[*Args]string{
|
||||
&Args{map[string]map[string]bool{
|
||||
"created": map[string]bool{"tomorrow": true}},
|
||||
}: "created",
|
||||
&Args{map[string]map[string]bool{
|
||||
"created": map[string]bool{"to(day": true}},
|
||||
}: "created",
|
||||
&Args{map[string]map[string]bool{
|
||||
"created": map[string]bool{"tom(.*)": true}},
|
||||
}: "created",
|
||||
&Args{map[string]map[string]bool{
|
||||
"created": map[string]bool{"tom": true}},
|
||||
}: "created",
|
||||
&Args{map[string]map[string]bool{
|
||||
"created": map[string]bool{"today1": true},
|
||||
"labels": map[string]bool{"today": true}},
|
||||
}: "created",
|
||||
}
|
||||
|
||||
for args, field := range differs {
|
||||
if args.Match(field, source) != false {
|
||||
t.Fatalf("Expected false for %v on %v, got true", source, args)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func TestAdd(t *testing.T) {
|
||||
f := NewArgs()
|
||||
f.Add("status", "running")
|
||||
v := f.fields["status"]
|
||||
if len(v) != 1 || !v["running"] {
|
||||
t.Fatalf("Expected to include a running status, got %v", v)
|
||||
}
|
||||
|
||||
f.Add("status", "paused")
|
||||
if len(v) != 2 || !v["paused"] {
|
||||
t.Fatalf("Expected to include a paused status, got %v", v)
|
||||
}
|
||||
}
|
||||
|
||||
func TestDel(t *testing.T) {
|
||||
f := NewArgs()
|
||||
f.Add("status", "running")
|
||||
f.Del("status", "running")
|
||||
v := f.fields["status"]
|
||||
if v["running"] {
|
||||
t.Fatalf("Expected to not include a running status filter, got true")
|
||||
}
|
||||
}
|
||||
|
||||
func TestLen(t *testing.T) {
|
||||
f := NewArgs()
|
||||
if f.Len() != 0 {
|
||||
t.Fatalf("Expected to not include any field")
|
||||
}
|
||||
f.Add("status", "running")
|
||||
if f.Len() != 1 {
|
||||
t.Fatalf("Expected to include one field")
|
||||
}
|
||||
}
|
||||
|
||||
func TestExactMatch(t *testing.T) {
|
||||
f := NewArgs()
|
||||
|
||||
if !f.ExactMatch("status", "running") {
|
||||
t.Fatalf("Expected to match `running` when there are no filters, got false")
|
||||
}
|
||||
|
||||
f.Add("status", "running")
|
||||
f.Add("status", "pause*")
|
||||
|
||||
if !f.ExactMatch("status", "running") {
|
||||
t.Fatalf("Expected to match `running` with one of the filters, got false")
|
||||
}
|
||||
|
||||
if f.ExactMatch("status", "paused") {
|
||||
t.Fatalf("Expected to not match `paused` with one of the filters, got true")
|
||||
}
|
||||
}
|
||||
|
||||
func TestInclude(t *testing.T) {
|
||||
f := NewArgs()
|
||||
if f.Include("status") {
|
||||
t.Fatalf("Expected to not include a status key, got true")
|
||||
}
|
||||
f.Add("status", "running")
|
||||
if !f.Include("status") {
|
||||
t.Fatalf("Expected to include a status key, got false")
|
||||
}
|
||||
}
|
||||
|
||||
func TestValidate(t *testing.T) {
|
||||
f := NewArgs()
|
||||
f.Add("status", "running")
|
||||
|
||||
valid := map[string]bool{
|
||||
"status": true,
|
||||
"dangling": true,
|
||||
}
|
||||
|
||||
if err := f.Validate(valid); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
f.Add("bogus", "running")
|
||||
if err := f.Validate(valid); err == nil {
|
||||
t.Fatalf("Expected to return an error, got nil")
|
||||
}
|
||||
}
|
||||
|
||||
func TestWalkValues(t *testing.T) {
|
||||
f := NewArgs()
|
||||
f.Add("status", "running")
|
||||
f.Add("status", "paused")
|
||||
|
||||
f.WalkValues("status", func(value string) error {
|
||||
if value != "running" && value != "paused" {
|
||||
t.Fatalf("Unexpected value %s", value)
|
||||
}
|
||||
return nil
|
||||
})
|
||||
|
||||
err := f.WalkValues("status", func(value string) error {
|
||||
return fmt.Errorf("return")
|
||||
})
|
||||
if err == nil {
|
||||
t.Fatalf("Expected to get an error, got nil")
|
||||
}
|
||||
|
||||
err = f.WalkValues("foo", func(value string) error {
|
||||
return fmt.Errorf("return")
|
||||
})
|
||||
if err != nil {
|
||||
t.Fatalf("Expected to not iterate when the field doesn't exist, got %v", err)
|
||||
}
|
||||
}
|
||||
|
||||
func TestFuzzyMatch(t *testing.T) {
|
||||
f := NewArgs()
|
||||
f.Add("container", "foo")
|
||||
|
||||
cases := map[string]bool{
|
||||
"foo": true,
|
||||
"foobar": true,
|
||||
"barfoo": false,
|
||||
"bar": false,
|
||||
}
|
||||
for source, match := range cases {
|
||||
got := f.FuzzyMatch("container", source)
|
||||
if got != match {
|
||||
t.Fatalf("Expected %v, got %v: %s", match, got, source)
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,135 +0,0 @@
|
|||
package strslice
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"reflect"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestStrSliceMarshalJSON(t *testing.T) {
|
||||
strss := map[*StrSlice]string{
|
||||
nil: "",
|
||||
&StrSlice{}: "null",
|
||||
&StrSlice{[]string{"/bin/sh", "-c", "echo"}}: `["/bin/sh","-c","echo"]`,
|
||||
}
|
||||
|
||||
for strs, expected := range strss {
|
||||
data, err := strs.MarshalJSON()
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if string(data) != expected {
|
||||
t.Fatalf("Expected %v, got %v", expected, string(data))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func TestStrSliceUnmarshalJSON(t *testing.T) {
|
||||
parts := map[string][]string{
|
||||
"": {"default", "values"},
|
||||
"[]": {},
|
||||
`["/bin/sh","-c","echo"]`: {"/bin/sh", "-c", "echo"},
|
||||
}
|
||||
for json, expectedParts := range parts {
|
||||
strs := &StrSlice{
|
||||
[]string{"default", "values"},
|
||||
}
|
||||
if err := strs.UnmarshalJSON([]byte(json)); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
actualParts := strs.Slice()
|
||||
if len(actualParts) != len(expectedParts) {
|
||||
t.Fatalf("Expected %v parts, got %v (%v)", len(expectedParts), len(actualParts), expectedParts)
|
||||
}
|
||||
for index, part := range actualParts {
|
||||
if part != expectedParts[index] {
|
||||
t.Fatalf("Expected %v, got %v", expectedParts, actualParts)
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func TestStrSliceUnmarshalString(t *testing.T) {
|
||||
var e *StrSlice
|
||||
echo, err := json.Marshal("echo")
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if err := json.Unmarshal(echo, &e); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
slice := e.Slice()
|
||||
if len(slice) != 1 {
|
||||
t.Fatalf("expected 1 element after unmarshal: %q", slice)
|
||||
}
|
||||
|
||||
if slice[0] != "echo" {
|
||||
t.Fatalf("expected `echo`, got: %q", slice[0])
|
||||
}
|
||||
}
|
||||
|
||||
func TestStrSliceUnmarshalSlice(t *testing.T) {
|
||||
var e *StrSlice
|
||||
echo, err := json.Marshal([]string{"echo"})
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if err := json.Unmarshal(echo, &e); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
slice := e.Slice()
|
||||
if len(slice) != 1 {
|
||||
t.Fatalf("expected 1 element after unmarshal: %q", slice)
|
||||
}
|
||||
|
||||
if slice[0] != "echo" {
|
||||
t.Fatalf("expected `echo`, got: %q", slice[0])
|
||||
}
|
||||
}
|
||||
|
||||
func TestStrSliceToString(t *testing.T) {
|
||||
slices := map[*StrSlice]string{
|
||||
New(""): "",
|
||||
New("one"): "one",
|
||||
New("one", "two"): "one two",
|
||||
}
|
||||
for s, expected := range slices {
|
||||
toString := s.ToString()
|
||||
if toString != expected {
|
||||
t.Fatalf("Expected %v, got %v", expected, toString)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func TestStrSliceLen(t *testing.T) {
|
||||
var emptyStrSlice *StrSlice
|
||||
slices := map[*StrSlice]int{
|
||||
New(""): 1,
|
||||
New("one"): 1,
|
||||
New("one", "two"): 2,
|
||||
emptyStrSlice: 0,
|
||||
}
|
||||
for s, expected := range slices {
|
||||
if s.Len() != expected {
|
||||
t.Fatalf("Expected %d, got %d", s.Len(), expected)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func TestStrSliceSlice(t *testing.T) {
|
||||
var emptyStrSlice *StrSlice
|
||||
slices := map[*StrSlice][]string{
|
||||
New("one"): {"one"},
|
||||
New("one", "two"): {"one", "two"},
|
||||
emptyStrSlice: nil,
|
||||
}
|
||||
for s, expected := range slices {
|
||||
if !reflect.DeepEqual(s.Slice(), expected) {
|
||||
t.Fatalf("Expected %v, got %v", s.Slice(), expected)
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,93 +0,0 @@
|
|||
package time
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"testing"
|
||||
"time"
|
||||
)
|
||||
|
||||
func TestGetTimestamp(t *testing.T) {
|
||||
now := time.Now()
|
||||
cases := []struct {
|
||||
in, expected string
|
||||
expectedErr bool
|
||||
}{
|
||||
// Partial RFC3339 strings get parsed with second precision
|
||||
{"2006-01-02T15:04:05.999999999+07:00", "1136189045.999999999", false},
|
||||
{"2006-01-02T15:04:05.999999999Z", "1136214245.999999999", false},
|
||||
{"2006-01-02T15:04:05.999999999", "1136214245.999999999", false},
|
||||
{"2006-01-02T15:04:05Z", "1136214245.000000000", false},
|
||||
{"2006-01-02T15:04:05", "1136214245.000000000", false},
|
||||
{"2006-01-02T15:04:0Z", "", true},
|
||||
{"2006-01-02T15:04:0", "", true},
|
||||
{"2006-01-02T15:04Z", "1136214240.000000000", false},
|
||||
{"2006-01-02T15:04+00:00", "1136214240.000000000", false},
|
||||
{"2006-01-02T15:04-00:00", "1136214240.000000000", false},
|
||||
{"2006-01-02T15:04", "1136214240.000000000", false},
|
||||
{"2006-01-02T15:0Z", "", true},
|
||||
{"2006-01-02T15:0", "", true},
|
||||
{"2006-01-02T15Z", "1136214000.000000000", false},
|
||||
{"2006-01-02T15+00:00", "1136214000.000000000", false},
|
||||
{"2006-01-02T15-00:00", "1136214000.000000000", false},
|
||||
{"2006-01-02T15", "1136214000.000000000", false},
|
||||
{"2006-01-02T1Z", "1136163600.000000000", false},
|
||||
{"2006-01-02T1", "1136163600.000000000", false},
|
||||
{"2006-01-02TZ", "", true},
|
||||
{"2006-01-02T", "", true},
|
||||
{"2006-01-02+00:00", "1136160000.000000000", false},
|
||||
{"2006-01-02-00:00", "1136160000.000000000", false},
|
||||
{"2006-01-02-00:01", "1136160060.000000000", false},
|
||||
{"2006-01-02Z", "1136160000.000000000", false},
|
||||
{"2006-01-02", "1136160000.000000000", false},
|
||||
{"2015-05-13T20:39:09Z", "1431549549.000000000", false},
|
||||
|
||||
// unix timestamps returned as is
|
||||
{"1136073600", "1136073600", false},
|
||||
{"1136073600.000000001", "1136073600.000000001", false},
|
||||
// Durations
|
||||
{"1m", fmt.Sprintf("%d", now.Add(-1*time.Minute).Unix()), false},
|
||||
{"1.5h", fmt.Sprintf("%d", now.Add(-90*time.Minute).Unix()), false},
|
||||
{"1h30m", fmt.Sprintf("%d", now.Add(-90*time.Minute).Unix()), false},
|
||||
|
||||
// String fallback
|
||||
{"invalid", "invalid", false},
|
||||
}
|
||||
|
||||
for _, c := range cases {
|
||||
o, err := GetTimestamp(c.in, now)
|
||||
if o != c.expected ||
|
||||
(err == nil && c.expectedErr) ||
|
||||
(err != nil && !c.expectedErr) {
|
||||
t.Errorf("wrong value for '%s'. expected:'%s' got:'%s' with error: `%s`", c.in, c.expected, o, err)
|
||||
t.Fail()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func TestParseTimestamps(t *testing.T) {
|
||||
cases := []struct {
|
||||
in string
|
||||
def, expectedS, expectedN int64
|
||||
expectedErr bool
|
||||
}{
|
||||
// unix timestamps
|
||||
{"1136073600", 0, 1136073600, 0, false},
|
||||
{"1136073600.000000001", 0, 1136073600, 1, false},
|
||||
{"1136073600.0000000010", 0, 1136073600, 1, false},
|
||||
{"1136073600.00000001", 0, 1136073600, 10, false},
|
||||
{"foo.bar", 0, 0, 0, true},
|
||||
{"1136073600.bar", 0, 1136073600, 0, true},
|
||||
{"", -1, -1, 0, false},
|
||||
}
|
||||
|
||||
for _, c := range cases {
|
||||
s, n, err := ParseTimestamps(c.in, c.def)
|
||||
if s != c.expectedS ||
|
||||
n != c.expectedN ||
|
||||
(err == nil && c.expectedErr) ||
|
||||
(err != nil && !c.expectedErr) {
|
||||
t.Errorf("wrong values for input `%s` with default `%d` expected:'%d'seconds and `%d`nanosecond got:'%d'seconds and `%d`nanoseconds with error: `%s`", c.in, c.def, c.expectedS, c.expectedN, s, n, err)
|
||||
t.Fail()
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,14 +0,0 @@
|
|||
## Legacy API type versions
|
||||
|
||||
This package includes types for legacy API versions. The stable version of the API types live in `api/types/*.go`.
|
||||
|
||||
Consider moving a type here when you need to keep backwards compatibility in the API. This legacy types are organized by the latest API version they appear in. For instance, types in the `v1p19` package are valid for API versions below or equal `1.19`. Types in the `v1p20` package are valid for the API version `1.20`, since the versions below that will use the legacy types in `v1p19`.
|
||||
|
||||
### Package name conventions
|
||||
|
||||
The package name convention is to use `v` as a prefix for the version number and `p`(patch) as a separator. We use this nomenclature due to a few restrictions in the Go package name convention:
|
||||
|
||||
1. We cannot use `.` because it's interpreted by the language, think of `v1.20.CallFunction`.
|
||||
2. We cannot use `_` because golint complains abount it. The code is actually valid, but it looks probably more weird: `v1_20.CallFunction`.
|
||||
|
||||
For instance, if you want to modify a type that was available in the version `1.21` of the API but it will have different fields in the version `1.22`, you want to create a new package under `api/types/versions/v1p21`.
|
|
@ -9,8 +9,8 @@ import (
|
|||
"os"
|
||||
"time"
|
||||
|
||||
"github.com/docker/docker/api/types"
|
||||
"github.com/docker/docker/api/types/container"
|
||||
"github.com/docker/engine-api/types"
|
||||
"github.com/docker/engine-api/types/container"
|
||||
)
|
||||
|
||||
// Context represents a file system tree.
|
||||
|
|
|
@ -10,11 +10,11 @@ import (
|
|||
"sync"
|
||||
|
||||
"github.com/Sirupsen/logrus"
|
||||
"github.com/docker/docker/api/types"
|
||||
"github.com/docker/docker/api/types/container"
|
||||
"github.com/docker/docker/builder"
|
||||
"github.com/docker/docker/builder/dockerfile/parser"
|
||||
"github.com/docker/docker/pkg/stringid"
|
||||
"github.com/docker/engine-api/types"
|
||||
"github.com/docker/engine-api/types/container"
|
||||
)
|
||||
|
||||
var validCommitCommands = map[string]bool{
|
||||
|
|
|
@ -18,13 +18,13 @@ import (
|
|||
|
||||
"github.com/Sirupsen/logrus"
|
||||
"github.com/docker/docker/api"
|
||||
"github.com/docker/docker/api/types/container"
|
||||
"github.com/docker/docker/api/types/strslice"
|
||||
"github.com/docker/docker/builder"
|
||||
derr "github.com/docker/docker/errors"
|
||||
"github.com/docker/docker/pkg/signal"
|
||||
"github.com/docker/docker/pkg/system"
|
||||
runconfigopts "github.com/docker/docker/runconfig/opts"
|
||||
"github.com/docker/engine-api/types/container"
|
||||
"github.com/docker/engine-api/types/strslice"
|
||||
"github.com/docker/go-connections/nat"
|
||||
)
|
||||
|
||||
|
|
|
@ -20,9 +20,6 @@ import (
|
|||
|
||||
"github.com/Sirupsen/logrus"
|
||||
"github.com/docker/docker/api"
|
||||
"github.com/docker/docker/api/types"
|
||||
"github.com/docker/docker/api/types/container"
|
||||
"github.com/docker/docker/api/types/strslice"
|
||||
"github.com/docker/docker/builder"
|
||||
"github.com/docker/docker/builder/dockerfile/parser"
|
||||
"github.com/docker/docker/pkg/archive"
|
||||
|
@ -36,6 +33,9 @@ import (
|
|||
"github.com/docker/docker/pkg/tarsum"
|
||||
"github.com/docker/docker/pkg/urlutil"
|
||||
"github.com/docker/docker/runconfig/opts"
|
||||
"github.com/docker/engine-api/types"
|
||||
"github.com/docker/engine-api/types/container"
|
||||
"github.com/docker/engine-api/types/strslice"
|
||||
)
|
||||
|
||||
func (b *Builder) commit(id string, autoCmd *strslice.StrSlice, comment string) error {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package builder
|
||||
|
||||
import "github.com/docker/docker/api/types/container"
|
||||
import "github.com/docker/engine-api/types/container"
|
||||
|
||||
// Image represents a Docker image used by the builder.
|
||||
type Image interface {
|
||||
|
|
|
@ -10,8 +10,8 @@ import (
|
|||
"path/filepath"
|
||||
"strings"
|
||||
|
||||
"github.com/docker/docker/api/types"
|
||||
"github.com/docker/docker/pkg/homedir"
|
||||
"github.com/docker/engine-api/types"
|
||||
)
|
||||
|
||||
const (
|
||||
|
|
|
@ -7,8 +7,8 @@ import (
|
|||
"strings"
|
||||
"testing"
|
||||
|
||||
"github.com/docker/docker/api/types"
|
||||
"github.com/docker/docker/pkg/homedir"
|
||||
"github.com/docker/engine-api/types"
|
||||
)
|
||||
|
||||
func TestEmptyConfigDir(t *testing.T) {
|
||||
|
|
|
@ -4,8 +4,8 @@ import (
|
|||
"os"
|
||||
"path/filepath"
|
||||
|
||||
"github.com/docker/docker/api/types"
|
||||
"github.com/docker/docker/pkg/archive"
|
||||
"github.com/docker/engine-api/types"
|
||||
)
|
||||
|
||||
// ResolvePath resolves the given path in the container to a resource on the
|
||||
|
|
|
@ -11,7 +11,6 @@ import (
|
|||
"time"
|
||||
|
||||
"github.com/Sirupsen/logrus"
|
||||
containertypes "github.com/docker/docker/api/types/container"
|
||||
"github.com/docker/docker/daemon/exec"
|
||||
"github.com/docker/docker/daemon/execdriver"
|
||||
"github.com/docker/docker/daemon/logger"
|
||||
|
@ -25,6 +24,7 @@ import (
|
|||
"github.com/docker/docker/pkg/symlink"
|
||||
"github.com/docker/docker/runconfig"
|
||||
"github.com/docker/docker/volume"
|
||||
containertypes "github.com/docker/engine-api/types/container"
|
||||
"github.com/docker/go-connections/nat"
|
||||
"github.com/opencontainers/runc/libcontainer/label"
|
||||
)
|
||||
|
|
|
@ -3,8 +3,8 @@ package container
|
|||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/docker/docker/api/types/container"
|
||||
"github.com/docker/docker/pkg/signal"
|
||||
"github.com/docker/engine-api/types/container"
|
||||
)
|
||||
|
||||
func TestContainerStopSignal(t *testing.T) {
|
||||
|
|
|
@ -13,8 +13,6 @@ import (
|
|||
"syscall"
|
||||
|
||||
"github.com/Sirupsen/logrus"
|
||||
"github.com/docker/docker/api/types/container"
|
||||
"github.com/docker/docker/api/types/network"
|
||||
"github.com/docker/docker/daemon/execdriver"
|
||||
derr "github.com/docker/docker/errors"
|
||||
"github.com/docker/docker/pkg/chrootarchive"
|
||||
|
@ -22,6 +20,8 @@ import (
|
|||
"github.com/docker/docker/pkg/system"
|
||||
"github.com/docker/docker/utils"
|
||||
"github.com/docker/docker/volume"
|
||||
"github.com/docker/engine-api/types/container"
|
||||
"github.com/docker/engine-api/types/network"
|
||||
"github.com/docker/go-connections/nat"
|
||||
"github.com/docker/libnetwork"
|
||||
"github.com/docker/libnetwork/netlabel"
|
||||
|
|
|
@ -3,9 +3,9 @@
|
|||
package container
|
||||
|
||||
import (
|
||||
"github.com/docker/docker/api/types/container"
|
||||
"github.com/docker/docker/daemon/execdriver"
|
||||
"github.com/docker/docker/volume"
|
||||
"github.com/docker/engine-api/types/container"
|
||||
)
|
||||
|
||||
// Container holds fields specific to the Windows implementation. See
|
||||
|
|
|
@ -9,12 +9,12 @@ import (
|
|||
"time"
|
||||
|
||||
"github.com/Sirupsen/logrus"
|
||||
"github.com/docker/docker/api/types/container"
|
||||
"github.com/docker/docker/daemon/execdriver"
|
||||
derr "github.com/docker/docker/errors"
|
||||
"github.com/docker/docker/pkg/promise"
|
||||
"github.com/docker/docker/pkg/stringid"
|
||||
"github.com/docker/docker/utils"
|
||||
"github.com/docker/engine-api/types/container"
|
||||
)
|
||||
|
||||
const (
|
||||
|
|
|
@ -7,11 +7,11 @@ import (
|
|||
"path/filepath"
|
||||
"strings"
|
||||
|
||||
"github.com/docker/docker/api/types"
|
||||
"github.com/docker/docker/container"
|
||||
"github.com/docker/docker/pkg/archive"
|
||||
"github.com/docker/docker/pkg/chrootarchive"
|
||||
"github.com/docker/docker/pkg/ioutils"
|
||||
"github.com/docker/engine-api/types"
|
||||
)
|
||||
|
||||
// ErrExtractPointNotDirectory is used to convey that the operation to extract
|
||||
|
|
|
@ -7,8 +7,6 @@ import (
|
|||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/docker/docker/api/types"
|
||||
containertypes "github.com/docker/docker/api/types/container"
|
||||
"github.com/docker/docker/container"
|
||||
"github.com/docker/docker/dockerversion"
|
||||
"github.com/docker/docker/image"
|
||||
|
@ -16,6 +14,8 @@ import (
|
|||
"github.com/docker/docker/pkg/archive"
|
||||
"github.com/docker/docker/pkg/ioutils"
|
||||
"github.com/docker/docker/reference"
|
||||
"github.com/docker/engine-api/types"
|
||||
containertypes "github.com/docker/engine-api/types/container"
|
||||
"github.com/docker/go-connections/nat"
|
||||
)
|
||||
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
package daemon
|
||||
|
||||
import (
|
||||
"github.com/docker/docker/api/types/container"
|
||||
"github.com/docker/docker/opts"
|
||||
flag "github.com/docker/docker/pkg/mflag"
|
||||
"github.com/docker/engine-api/types/container"
|
||||
)
|
||||
|
||||
const (
|
||||
|
|
|
@ -13,8 +13,6 @@ import (
|
|||
"time"
|
||||
|
||||
"github.com/Sirupsen/logrus"
|
||||
containertypes "github.com/docker/docker/api/types/container"
|
||||
networktypes "github.com/docker/docker/api/types/network"
|
||||
"github.com/docker/docker/container"
|
||||
"github.com/docker/docker/daemon/execdriver"
|
||||
"github.com/docker/docker/daemon/links"
|
||||
|
@ -25,6 +23,8 @@ import (
|
|||
"github.com/docker/docker/pkg/mount"
|
||||
"github.com/docker/docker/pkg/stringid"
|
||||
"github.com/docker/docker/runconfig"
|
||||
containertypes "github.com/docker/engine-api/types/container"
|
||||
networktypes "github.com/docker/engine-api/types/network"
|
||||
"github.com/docker/go-units"
|
||||
"github.com/docker/libnetwork"
|
||||
"github.com/docker/libnetwork/netlabel"
|
||||
|
|
|
@ -2,8 +2,6 @@ package daemon
|
|||
|
||||
import (
|
||||
"github.com/Sirupsen/logrus"
|
||||
"github.com/docker/docker/api/types"
|
||||
containertypes "github.com/docker/docker/api/types/container"
|
||||
"github.com/docker/docker/container"
|
||||
derr "github.com/docker/docker/errors"
|
||||
"github.com/docker/docker/image"
|
||||
|
@ -11,6 +9,8 @@ import (
|
|||
"github.com/docker/docker/pkg/idtools"
|
||||
"github.com/docker/docker/pkg/stringid"
|
||||
volumestore "github.com/docker/docker/volume/store"
|
||||
"github.com/docker/engine-api/types"
|
||||
containertypes "github.com/docker/engine-api/types/container"
|
||||
"github.com/opencontainers/runc/libcontainer/label"
|
||||
)
|
||||
|
||||
|
|
|
@ -6,12 +6,12 @@ import (
|
|||
"os"
|
||||
"path/filepath"
|
||||
|
||||
containertypes "github.com/docker/docker/api/types/container"
|
||||
"github.com/docker/docker/container"
|
||||
derr "github.com/docker/docker/errors"
|
||||
"github.com/docker/docker/image"
|
||||
"github.com/docker/docker/pkg/stringid"
|
||||
"github.com/docker/docker/volume"
|
||||
containertypes "github.com/docker/engine-api/types/container"
|
||||
"github.com/opencontainers/runc/libcontainer/label"
|
||||
)
|
||||
|
||||
|
|
|
@ -3,11 +3,11 @@ package daemon
|
|||
import (
|
||||
"fmt"
|
||||
|
||||
containertypes "github.com/docker/docker/api/types/container"
|
||||
"github.com/docker/docker/container"
|
||||
"github.com/docker/docker/image"
|
||||
"github.com/docker/docker/pkg/stringid"
|
||||
"github.com/docker/docker/volume"
|
||||
containertypes "github.com/docker/engine-api/types/container"
|
||||
)
|
||||
|
||||
// createContainerPlatformSpecificSettings performs platform specific container create functionality
|
||||
|
|
|
@ -22,17 +22,17 @@ import (
|
|||
"github.com/Sirupsen/logrus"
|
||||
"github.com/docker/distribution/digest"
|
||||
"github.com/docker/docker/api"
|
||||
"github.com/docker/docker/api/types"
|
||||
containertypes "github.com/docker/docker/api/types/container"
|
||||
eventtypes "github.com/docker/docker/api/types/events"
|
||||
"github.com/docker/docker/api/types/filters"
|
||||
registrytypes "github.com/docker/docker/api/types/registry"
|
||||
"github.com/docker/docker/api/types/strslice"
|
||||
"github.com/docker/docker/container"
|
||||
"github.com/docker/docker/daemon/events"
|
||||
"github.com/docker/docker/daemon/exec"
|
||||
"github.com/docker/docker/daemon/execdriver"
|
||||
"github.com/docker/docker/daemon/execdriver/execdrivers"
|
||||
"github.com/docker/engine-api/types"
|
||||
containertypes "github.com/docker/engine-api/types/container"
|
||||
eventtypes "github.com/docker/engine-api/types/events"
|
||||
"github.com/docker/engine-api/types/filters"
|
||||
registrytypes "github.com/docker/engine-api/types/registry"
|
||||
"github.com/docker/engine-api/types/strslice"
|
||||
// register graph drivers
|
||||
_ "github.com/docker/docker/daemon/graphdriver/register"
|
||||
"github.com/docker/docker/daemon/logger"
|
||||
|
|
|
@ -9,8 +9,8 @@ import (
|
|||
"runtime"
|
||||
|
||||
"github.com/Sirupsen/logrus"
|
||||
"github.com/docker/docker/api/types/container"
|
||||
"github.com/docker/docker/pkg/idtools"
|
||||
"github.com/docker/engine-api/types/container"
|
||||
)
|
||||
|
||||
func setupRemappedRoot(config *Config) ([]idtools.IDMap, []idtools.IDMap, error) {
|
||||
|
|
|
@ -5,9 +5,9 @@ package daemon
|
|||
import (
|
||||
"os"
|
||||
|
||||
"github.com/docker/docker/api/types/container"
|
||||
"github.com/docker/docker/pkg/idtools"
|
||||
"github.com/docker/docker/pkg/system"
|
||||
"github.com/docker/engine-api/types/container"
|
||||
)
|
||||
|
||||
func setupRemappedRoot(config *Config) ([]idtools.IDMap, []idtools.IDMap, error) {
|
||||
|
|
|
@ -7,7 +7,6 @@ import (
|
|||
"path/filepath"
|
||||
"testing"
|
||||
|
||||
containertypes "github.com/docker/docker/api/types/container"
|
||||
"github.com/docker/docker/container"
|
||||
"github.com/docker/docker/pkg/graphdb"
|
||||
"github.com/docker/docker/pkg/truncindex"
|
||||
|
@ -15,6 +14,7 @@ import (
|
|||
volumedrivers "github.com/docker/docker/volume/drivers"
|
||||
"github.com/docker/docker/volume/local"
|
||||
"github.com/docker/docker/volume/store"
|
||||
containertypes "github.com/docker/engine-api/types/container"
|
||||
"github.com/docker/go-connections/nat"
|
||||
)
|
||||
|
||||
|
|
|
@ -12,8 +12,6 @@ import (
|
|||
"syscall"
|
||||
|
||||
"github.com/Sirupsen/logrus"
|
||||
pblkiodev "github.com/docker/docker/api/types/blkiodev"
|
||||
containertypes "github.com/docker/docker/api/types/container"
|
||||
"github.com/docker/docker/container"
|
||||
derr "github.com/docker/docker/errors"
|
||||
"github.com/docker/docker/image"
|
||||
|
@ -24,6 +22,8 @@ import (
|
|||
"github.com/docker/docker/reference"
|
||||
"github.com/docker/docker/runconfig"
|
||||
runconfigopts "github.com/docker/docker/runconfig/opts"
|
||||
pblkiodev "github.com/docker/engine-api/types/blkiodev"
|
||||
containertypes "github.com/docker/engine-api/types/container"
|
||||
"github.com/docker/libnetwork"
|
||||
nwconfig "github.com/docker/libnetwork/config"
|
||||
"github.com/docker/libnetwork/drivers/bridge"
|
||||
|
|
|
@ -7,7 +7,7 @@ import (
|
|||
"os"
|
||||
"testing"
|
||||
|
||||
"github.com/docker/docker/api/types/container"
|
||||
"github.com/docker/engine-api/types/container"
|
||||
)
|
||||
|
||||
func TestAdjustCPUShares(t *testing.T) {
|
||||
|
|
|
@ -9,13 +9,13 @@ import (
|
|||
"strings"
|
||||
|
||||
"github.com/Sirupsen/logrus"
|
||||
containertypes "github.com/docker/docker/api/types/container"
|
||||
"github.com/docker/docker/container"
|
||||
"github.com/docker/docker/daemon/graphdriver"
|
||||
"github.com/docker/docker/dockerversion"
|
||||
"github.com/docker/docker/image"
|
||||
"github.com/docker/docker/layer"
|
||||
"github.com/docker/docker/reference"
|
||||
containertypes "github.com/docker/engine-api/types/container"
|
||||
// register the windows graph driver
|
||||
"github.com/docker/docker/daemon/graphdriver/windows"
|
||||
"github.com/docker/docker/pkg/system"
|
||||
|
|
|
@ -10,8 +10,6 @@ import (
|
|||
|
||||
"github.com/Sirupsen/logrus"
|
||||
"github.com/docker/docker/api"
|
||||
"github.com/docker/docker/api/types"
|
||||
"github.com/docker/docker/api/types/container"
|
||||
"github.com/docker/docker/builder"
|
||||
"github.com/docker/docker/daemon"
|
||||
"github.com/docker/docker/image"
|
||||
|
@ -22,6 +20,8 @@ import (
|
|||
"github.com/docker/docker/pkg/urlutil"
|
||||
"github.com/docker/docker/reference"
|
||||
"github.com/docker/docker/registry"
|
||||
"github.com/docker/engine-api/types"
|
||||
"github.com/docker/engine-api/types/container"
|
||||
)
|
||||
|
||||
// Docker implements builder.Backend for the docker Daemon object.
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
package daemonbuilder
|
||||
|
||||
import (
|
||||
"github.com/docker/docker/api/types/container"
|
||||
"github.com/docker/docker/image"
|
||||
"github.com/docker/engine-api/types/container"
|
||||
)
|
||||
|
||||
type imgWrap struct {
|
||||
|
|
|
@ -5,11 +5,11 @@ import (
|
|||
"path"
|
||||
|
||||
"github.com/Sirupsen/logrus"
|
||||
"github.com/docker/docker/api/types"
|
||||
"github.com/docker/docker/container"
|
||||
derr "github.com/docker/docker/errors"
|
||||
"github.com/docker/docker/layer"
|
||||
volumestore "github.com/docker/docker/volume/store"
|
||||
"github.com/docker/engine-api/types"
|
||||
)
|
||||
|
||||
// ContainerRm removes the container id from the filesystem. An error
|
||||
|
|
|
@ -5,9 +5,9 @@ import (
|
|||
"os"
|
||||
"testing"
|
||||
|
||||
"github.com/docker/docker/api/types"
|
||||
containertypes "github.com/docker/docker/api/types/container"
|
||||
"github.com/docker/docker/container"
|
||||
"github.com/docker/engine-api/types"
|
||||
containertypes "github.com/docker/engine-api/types/container"
|
||||
)
|
||||
|
||||
func TestContainerDoubleDelete(t *testing.T) {
|
||||
|
|
|
@ -3,8 +3,8 @@ package daemon
|
|||
import (
|
||||
"strings"
|
||||
|
||||
"github.com/docker/docker/api/types/events"
|
||||
"github.com/docker/docker/container"
|
||||
"github.com/docker/engine-api/types/events"
|
||||
"github.com/docker/libnetwork"
|
||||
)
|
||||
|
||||
|
|
|
@ -4,8 +4,8 @@ import (
|
|||
"sync"
|
||||
"time"
|
||||
|
||||
eventtypes "github.com/docker/docker/api/types/events"
|
||||
"github.com/docker/docker/pkg/pubsub"
|
||||
eventtypes "github.com/docker/engine-api/types/events"
|
||||
)
|
||||
|
||||
const (
|
||||
|
|
|
@ -5,7 +5,7 @@ import (
|
|||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/docker/docker/api/types/events"
|
||||
"github.com/docker/engine-api/types/events"
|
||||
)
|
||||
|
||||
func TestEventsLog(t *testing.T) {
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
package events
|
||||
|
||||
import (
|
||||
"github.com/docker/docker/api/types/events"
|
||||
"github.com/docker/docker/api/types/filters"
|
||||
"github.com/docker/docker/reference"
|
||||
"github.com/docker/engine-api/types/events"
|
||||
"github.com/docker/engine-api/types/filters"
|
||||
)
|
||||
|
||||
// Filter can filter out docker events from a stream
|
||||
|
|
|
@ -3,9 +3,9 @@ package daemon
|
|||
import (
|
||||
"testing"
|
||||
|
||||
containertypes "github.com/docker/docker/api/types/container"
|
||||
"github.com/docker/docker/container"
|
||||
"github.com/docker/docker/daemon/events"
|
||||
containertypes "github.com/docker/engine-api/types/container"
|
||||
)
|
||||
|
||||
func TestLogContainerCopyLabels(t *testing.T) {
|
||||
|
|
|
@ -6,8 +6,6 @@ import (
|
|||
"time"
|
||||
|
||||
"github.com/Sirupsen/logrus"
|
||||
"github.com/docker/docker/api/types"
|
||||
"github.com/docker/docker/api/types/strslice"
|
||||
"github.com/docker/docker/container"
|
||||
"github.com/docker/docker/daemon/exec"
|
||||
"github.com/docker/docker/daemon/execdriver"
|
||||
|
@ -15,6 +13,8 @@ import (
|
|||
"github.com/docker/docker/pkg/pools"
|
||||
"github.com/docker/docker/pkg/promise"
|
||||
"github.com/docker/docker/pkg/term"
|
||||
"github.com/docker/engine-api/types"
|
||||
"github.com/docker/engine-api/types/strslice"
|
||||
)
|
||||
|
||||
func (d *Daemon) registerExecCommand(container *container.Container, config *exec.Config) {
|
||||
|
|
|
@ -3,9 +3,9 @@
|
|||
package daemon
|
||||
|
||||
import (
|
||||
"github.com/docker/docker/api/types"
|
||||
"github.com/docker/docker/container"
|
||||
"github.com/docker/docker/daemon/execdriver"
|
||||
"github.com/docker/engine-api/types"
|
||||
)
|
||||
|
||||
// setPlatformSpecificExecProcessConfig sets platform-specific fields in the
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
package daemon
|
||||
|
||||
import (
|
||||
"github.com/docker/docker/api/types"
|
||||
"github.com/docker/docker/container"
|
||||
"github.com/docker/docker/daemon/execdriver"
|
||||
"github.com/docker/engine-api/types"
|
||||
)
|
||||
|
||||
// setPlatformSpecificExecProcessConfig sets platform-specific fields in the
|
||||
|
|
|
@ -3,8 +3,8 @@
|
|||
package windows
|
||||
|
||||
import (
|
||||
"github.com/docker/docker/api/types/container"
|
||||
"github.com/docker/docker/daemon/execdriver"
|
||||
"github.com/docker/engine-api/types/container"
|
||||
)
|
||||
|
||||
type info struct {
|
||||
|
|
|
@ -8,10 +8,10 @@ import (
|
|||
"sync"
|
||||
|
||||
"github.com/Sirupsen/logrus"
|
||||
"github.com/docker/docker/api/types/container"
|
||||
"github.com/docker/docker/daemon/execdriver"
|
||||
"github.com/docker/docker/dockerversion"
|
||||
"github.com/docker/docker/pkg/parsers"
|
||||
"github.com/docker/engine-api/types/container"
|
||||
)
|
||||
|
||||
// This is a daemon development variable only and should not be
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue