From 1dab9af5d5acc1fe3a1bfb84a5cc576d664095e4 Mon Sep 17 00:00:00 2001 From: Yong Tang Date: Mon, 30 May 2016 15:46:24 -0700 Subject: [PATCH] Vendor engine-api to 6facb3f3c38717b8f618dcedc4c8ce20d1bfc61e This fix updates engine-api to 6facb3f3c38717b8f618dcedc4c8ce20d1bfc61e. This fix is related to #23090. Signed-off-by: Yong Tang --- hack/vendor.sh | 2 +- .../docker/engine-api/client/image_tag.go | 6 +-- .../docker/engine-api/client/interface.go | 4 +- .../engine-api/client/network_inspect.go | 24 +++++++-- .../engine-api/client/volume_inspect.go | 24 +++++++-- .../docker/engine-api/types/client.go | 5 -- .../docker/engine-api/types/types.go | 54 +++++++++---------- 7 files changed, 70 insertions(+), 49 deletions(-) diff --git a/hack/vendor.sh b/hack/vendor.sh index 227e8fb935..3b9a614227 100755 --- a/hack/vendor.sh +++ b/hack/vendor.sh @@ -60,7 +60,7 @@ clone git golang.org/x/net 78cb2c067747f08b343f20614155233ab4ea2ad3 https://gith clone git golang.org/x/sys eb2c74142fd19a79b3f237334c7384d5167b1b46 https://github.com/golang/sys.git clone git github.com/docker/go-units 651fc226e7441360384da338d0fd37f2440ffbe3 clone git github.com/docker/go-connections v0.2.0 -clone git github.com/docker/engine-api 12fbeb3ac3ca5dc5d0f01d6bac9bda518d46d983 +clone git github.com/docker/engine-api 6facb3f3c38717b8f618dcedc4c8ce20d1bfc61e clone git github.com/RackSec/srslog 259aed10dfa74ea2961eddd1d9847619f6e98837 clone git github.com/imdario/mergo 0.2.1 diff --git a/vendor/src/github.com/docker/engine-api/client/image_tag.go b/vendor/src/github.com/docker/engine-api/client/image_tag.go index 490de4e5fe..7182913672 100644 --- a/vendor/src/github.com/docker/engine-api/client/image_tag.go +++ b/vendor/src/github.com/docker/engine-api/client/image_tag.go @@ -8,12 +8,11 @@ import ( "golang.org/x/net/context" distreference "github.com/docker/distribution/reference" - "github.com/docker/engine-api/types" "github.com/docker/engine-api/types/reference" ) // ImageTag tags an image in the docker host -func (cli *Client) ImageTag(ctx context.Context, imageID, ref string, options types.ImageTagOptions) error { +func (cli *Client) ImageTag(ctx context.Context, imageID, ref string) error { distributionRef, err := distreference.ParseNamed(ref) if err != nil { return fmt.Errorf("Error parsing reference: %q is not a valid repository/tag", ref) @@ -28,9 +27,6 @@ func (cli *Client) ImageTag(ctx context.Context, imageID, ref string, options ty query := url.Values{} query.Set("repo", distributionRef.Name()) query.Set("tag", tag) - if options.Force { - query.Set("force", "1") - } resp, err := cli.post(ctx, "/images/"+imageID+"/tag", query, nil, nil) ensureReaderClosed(resp) diff --git a/vendor/src/github.com/docker/engine-api/client/interface.go b/vendor/src/github.com/docker/engine-api/client/interface.go index 2dc9b22987..85d1a7d290 100644 --- a/vendor/src/github.com/docker/engine-api/client/interface.go +++ b/vendor/src/github.com/docker/engine-api/client/interface.go @@ -61,12 +61,13 @@ type APIClient interface { ImageRemove(ctx context.Context, image string, options types.ImageRemoveOptions) ([]types.ImageDelete, error) ImageSearch(ctx context.Context, term string, options types.ImageSearchOptions) ([]registry.SearchResult, error) ImageSave(ctx context.Context, images []string) (io.ReadCloser, error) - ImageTag(ctx context.Context, image, ref string, options types.ImageTagOptions) error + ImageTag(ctx context.Context, image, ref string) error Info(ctx context.Context) (types.Info, error) NetworkConnect(ctx context.Context, networkID, container string, config *network.EndpointSettings) error NetworkCreate(ctx context.Context, name string, options types.NetworkCreate) (types.NetworkCreateResponse, error) NetworkDisconnect(ctx context.Context, networkID, container string, force bool) error NetworkInspect(ctx context.Context, networkID string) (types.NetworkResource, error) + NetworkInspectWithRaw(ctx context.Context, networkID string) (types.NetworkResource, []byte, error) NetworkList(ctx context.Context, options types.NetworkListOptions) ([]types.NetworkResource, error) NetworkRemove(ctx context.Context, networkID string) error RegistryLogin(ctx context.Context, auth types.AuthConfig) (types.AuthResponse, error) @@ -74,6 +75,7 @@ type APIClient interface { UpdateClientVersion(v string) VolumeCreate(ctx context.Context, options types.VolumeCreateRequest) (types.Volume, error) VolumeInspect(ctx context.Context, volumeID string) (types.Volume, error) + VolumeInspectWithRaw(ctx context.Context, volumeID string) (types.Volume, []byte, error) VolumeList(ctx context.Context, filter filters.Args) (types.VolumesListResponse, error) VolumeRemove(ctx context.Context, volumeID string) error } diff --git a/vendor/src/github.com/docker/engine-api/client/network_inspect.go b/vendor/src/github.com/docker/engine-api/client/network_inspect.go index 4f81e5ce40..89469f52c5 100644 --- a/vendor/src/github.com/docker/engine-api/client/network_inspect.go +++ b/vendor/src/github.com/docker/engine-api/client/network_inspect.go @@ -1,7 +1,9 @@ package client import ( + "bytes" "encoding/json" + "io/ioutil" "net/http" "github.com/docker/engine-api/types" @@ -10,15 +12,27 @@ import ( // NetworkInspect returns the information for a specific network configured in the docker host. func (cli *Client) NetworkInspect(ctx context.Context, networkID string) (types.NetworkResource, error) { + networkResource, _, err := cli.NetworkInspectWithRaw(ctx, networkID) + return networkResource, err +} + +// NetworkInspectWithRaw returns the information for a specific network configured in the docker host and it's raw representation. +func (cli *Client) NetworkInspectWithRaw(ctx context.Context, networkID string) (types.NetworkResource, []byte, error) { var networkResource types.NetworkResource resp, err := cli.get(ctx, "/networks/"+networkID, nil, nil) if err != nil { if resp.statusCode == http.StatusNotFound { - return networkResource, networkNotFoundError{networkID} + return networkResource, nil, networkNotFoundError{networkID} } - return networkResource, err + return networkResource, nil, err } - err = json.NewDecoder(resp.body).Decode(&networkResource) - ensureReaderClosed(resp) - return networkResource, err + defer ensureReaderClosed(resp) + + body, err := ioutil.ReadAll(resp.body) + if err != nil { + return networkResource, nil, err + } + rdr := bytes.NewReader(body) + err = json.NewDecoder(rdr).Decode(&networkResource) + return networkResource, body, err } diff --git a/vendor/src/github.com/docker/engine-api/client/volume_inspect.go b/vendor/src/github.com/docker/engine-api/client/volume_inspect.go index 4bf4a7b084..0c50c76bb8 100644 --- a/vendor/src/github.com/docker/engine-api/client/volume_inspect.go +++ b/vendor/src/github.com/docker/engine-api/client/volume_inspect.go @@ -1,7 +1,9 @@ package client import ( + "bytes" "encoding/json" + "io/ioutil" "net/http" "github.com/docker/engine-api/types" @@ -10,15 +12,27 @@ import ( // VolumeInspect returns the information about a specific volume in the docker host. func (cli *Client) VolumeInspect(ctx context.Context, volumeID string) (types.Volume, error) { + volume, _, err := cli.VolumeInspectWithRaw(ctx, volumeID) + return volume, err +} + +// VolumeInspectWithRaw returns the information about a specific volume in the docker host and it's raw representation +func (cli *Client) VolumeInspectWithRaw(ctx context.Context, volumeID string) (types.Volume, []byte, error) { var volume types.Volume resp, err := cli.get(ctx, "/volumes/"+volumeID, nil, nil) if err != nil { if resp.statusCode == http.StatusNotFound { - return volume, volumeNotFoundError{volumeID} + return volume, nil, volumeNotFoundError{volumeID} } - return volume, err + return volume, nil, err } - err = json.NewDecoder(resp.body).Decode(&volume) - ensureReaderClosed(resp) - return volume, err + defer ensureReaderClosed(resp) + + body, err := ioutil.ReadAll(resp.body) + if err != nil { + return volume, nil, err + } + rdr := bytes.NewReader(body) + err = json.NewDecoder(rdr).Decode(&volume) + return volume, body, err } diff --git a/vendor/src/github.com/docker/engine-api/types/client.go b/vendor/src/github.com/docker/engine-api/types/client.go index 1b529a905f..5e8fbbab48 100644 --- a/vendor/src/github.com/docker/engine-api/types/client.go +++ b/vendor/src/github.com/docker/engine-api/types/client.go @@ -215,11 +215,6 @@ type ImageSearchOptions struct { Filters filters.Args } -// ImageTagOptions holds parameters to tag an image -type ImageTagOptions struct { - Force bool -} - // ResizeOptions holds parameters to resize a tty. // It can be used to resize container ttys and // exec process ttys too. diff --git a/vendor/src/github.com/docker/engine-api/types/types.go b/vendor/src/github.com/docker/engine-api/types/types.go index 7994c11811..83e56735be 100644 --- a/vendor/src/github.com/docker/engine-api/types/types.go +++ b/vendor/src/github.com/docker/engine-api/types/types.go @@ -28,7 +28,7 @@ type ContainerExecCreateResponse struct { } // ContainerUpdateResponse contains response of Remote API: -// POST /containers/{name:.*}/update +// POST "/containers/{name:.*}/update" type ContainerUpdateResponse struct { // Warnings are any warnings encountered during the updating of the container. Warnings []string `json:"Warnings"` @@ -142,7 +142,7 @@ type Port struct { } // Container contains response of Remote API: -// GET "/containers/json" +// GET "/containers/json" type Container struct { ID string `json:"Id"` Names []string @@ -352,13 +352,13 @@ type SummaryNetworkSettings struct { // NetworkSettingsBase holds basic information about networks type NetworkSettingsBase struct { - Bridge string - SandboxID string - HairpinMode bool - LinkLocalIPv6Address string - LinkLocalIPv6PrefixLen int - Ports nat.PortMap - SandboxKey string + Bridge string // Bridge is the Bridge name the network uses(e.g. `docker0`) + SandboxID string // SandboxID uniquely represents a container's network stack + HairpinMode bool // HairpinMode specifies if hairpin NAT should be enabled on the virtual interface + LinkLocalIPv6Address string // LinkLocalIPv6Address is an IPv6 unicast address using the link-local prefix + LinkLocalIPv6PrefixLen int // LinkLocalIPv6PrefixLen is the prefix length of an IPv6 unicast address + Ports nat.PortMap // Ports is a collection of PortBinding indexed by Port + SandboxKey string // SandboxKey identifies the sandbox SecondaryIPAddresses []network.Address SecondaryIPv6Addresses []network.Address } @@ -367,14 +367,14 @@ type NetworkSettingsBase struct { // during the 2 release deprecation period. // It will be removed in Docker 1.11. type DefaultNetworkSettings struct { - EndpointID string - Gateway string - GlobalIPv6Address string - GlobalIPv6PrefixLen int - IPAddress string - IPPrefixLen int - IPv6Gateway string - MacAddress string + EndpointID string // EndpointID uniquely represents a service endpoint in a Sandbox + Gateway string // Gateway holds the gateway address for the network + GlobalIPv6Address string // GlobalIPv6Address holds network's global IPv6 address + GlobalIPv6PrefixLen int // GlobalIPv6PrefixLen represents mask length of network's global IPv6 address + IPAddress string // IPAddress holds the IPv4 address for the network + IPPrefixLen int // IPPrefixLen represents mask length of network's IPv4 address + IPv6Gateway string // IPv6Gateway holds gateway address specific for IPv6 + MacAddress string // MacAddress holds the MAC address for the network } // MountPoint represents a mount point configuration inside the container. @@ -416,16 +416,16 @@ type VolumeCreateRequest struct { // NetworkResource is the body of the "get network" http response message type NetworkResource struct { - Name string - ID string `json:"Id"` - Scope string - Driver string - EnableIPv6 bool - IPAM network.IPAM - Internal bool - Containers map[string]EndpointResource - Options map[string]string - Labels map[string]string + Name string // Name is the requested name of the network + ID string `json:"Id"` // ID uniquely indentifies a network on a single machine + Scope string // Scope describes the level at which the network exists (e.g. `global` for cluster-wide or `local` for machine level) + Driver string // Driver is the Driver name used to create the network (e.g. `bridge`, `overlay`) + EnableIPv6 bool // EnableIPv6 represents whether to enable IPv6 + IPAM network.IPAM // IPAM is the network's IP Address Management + Internal bool // Internal respresents if the network is used internal only + Containers map[string]EndpointResource // Containers contains endpoints belonging to the network + Options map[string]string // Options holds the network specific options to use for when creating the network + Labels map[string]string // Labels holds metadata specific to the network being created } // EndpointResource contains network resources allocated and used for a container in a network