Merge pull request #26200 from runcom/engine-api-vendor

vendor docker/engine-api@f9cef59044
Upstream-commit: 8ccac1ad4de898583113d036810da3a35a9be906
Component: engine
This commit is contained in:
Justin Cormack
2016-09-01 10:51:34 +01:00
committed by GitHub
26 changed files with 138 additions and 76 deletions

View File

@ -134,13 +134,21 @@ func runUpdate(dockerCli *client.DockerCli, opts *updateOptions) error {
ctx := context.Background()
var errs []string
var (
warns []string
errs []string
)
for _, container := range opts.containers {
if err := dockerCli.Client().ContainerUpdate(ctx, container, updateConfig); err != nil {
r, err := dockerCli.Client().ContainerUpdate(ctx, container, updateConfig)
if err != nil {
errs = append(errs, err.Error())
} else {
fmt.Fprintf(dockerCli.Out(), "%s\n", container)
}
warns = append(warns, r.Warnings...)
}
if len(warns) > 0 {
fmt.Fprintf(dockerCli.Out(), "%s", strings.Join(warns, "\n"))
}
if len(errs) > 0 {
return fmt.Errorf("%s", strings.Join(errs, "\n"))

View File

@ -79,7 +79,7 @@ func runCreate(dockerCli *client.DockerCli, opts createOptions) error {
nc := types.NetworkCreate{
Driver: opts.driver,
Options: opts.driverOpts.GetAll(),
IPAM: network.IPAM{
IPAM: &network.IPAM{
Driver: opts.ipamDriver,
Config: ipamCfg,
Options: opts.ipamOpt.GetAll(),

View File

@ -12,7 +12,6 @@ import (
"github.com/docker/docker/api/client/bundlefile"
"github.com/docker/docker/cli"
"github.com/docker/engine-api/types"
"github.com/docker/engine-api/types/network"
"github.com/docker/engine-api/types/swarm"
)
@ -105,8 +104,6 @@ func updateNetworks(
createOpts := types.NetworkCreate{
Labels: getStackLabels(namespace, nil),
Driver: defaultNetworkDriver,
// TODO: remove when engine-api uses omitempty for IPAM
IPAM: network.IPAM{Driver: "default"},
}
for _, internalName := range networks {

View File

@ -172,7 +172,7 @@ func addSwarmFlags(flags *pflag.FlagSet, opts *swarmOptions) {
func (opts *swarmOptions) ToSpec() swarm.Spec {
spec := swarm.Spec{}
spec.Orchestration.TaskHistoryRetentionLimit = opts.taskHistoryLimit
spec.Dispatcher.HeartbeatPeriod = uint64(opts.dispatcherHeartbeat.Nanoseconds())
spec.Dispatcher.HeartbeatPeriod = opts.dispatcherHeartbeat
spec.CAConfig.NodeCertExpiry = opts.nodeCertExpiry
spec.CAConfig.ExternalCAs = opts.externalCA.Value()
return spec

View File

@ -63,7 +63,7 @@ func mergeSwarm(swarm *swarm.Swarm, flags *pflag.FlagSet) error {
if flags.Changed(flagDispatcherHeartbeat) {
if v, err := flags.GetDuration(flagDispatcherHeartbeat); err == nil {
spec.Dispatcher.HeartbeatPeriod = uint64(v.Nanoseconds())
spec.Dispatcher.HeartbeatPeriod = v
}
}

View File

@ -42,7 +42,7 @@ type stateBackend interface {
ContainerStart(name string, hostConfig *container.HostConfig, validateHostname bool) error
ContainerStop(name string, seconds int) error
ContainerUnpause(name string) error
ContainerUpdate(name string, hostConfig *container.HostConfig, validateHostname bool) ([]string, error)
ContainerUpdate(name string, hostConfig *container.HostConfig, validateHostname bool) (types.ContainerUpdateResponse, error)
ContainerWait(name string, timeout time.Duration) (int, error)
}

View File

@ -327,14 +327,12 @@ func (s *containerRouter) postContainerUpdate(ctx context.Context, w http.Respon
name := vars["name"]
validateHostname := versions.GreaterThanOrEqualTo(version, "1.24")
warnings, err := s.backend.ContainerUpdate(name, hostConfig, validateHostname)
resp, err := s.backend.ContainerUpdate(name, hostConfig, validateHostname)
if err != nil {
return err
}
return httputils.WriteJSON(w, http.StatusOK, &types.ContainerUpdateResponse{
Warnings: warnings,
})
return httputils.WriteJSON(w, http.StatusOK, resp)
}
func (s *containerRouter) postContainersCreate(ctx context.Context, w http.ResponseWriter, r *http.Request, vars map[string]string) error {