Merge pull request #30646 from vieux/1.13.1-rc2-cherrypicks-2

1.13.1 rc2 cherrypicks 2
This commit is contained in:
Vincent Demeester 2017-02-02 11:31:19 +01:00 committed by GitHub
commit fbc84e24aa
9 changed files with 125 additions and 14 deletions

View file

@ -137,7 +137,7 @@ func (s *Server) makeHTTPHandler(handler httputils.APIFunc) http.HandlerFunc {
}
if err := handlerFunc(ctx, w, r, vars); err != nil {
logrus.Errorf("Handler for %s %s returned error: %v", r.Method, r.URL.Path, err)
logrus.Errorf("Handler for %s %s returned error: %+v", r.Method, r.URL.Path, err)
httputils.MakeErrorHandler(err)(w, r)
}
}

View file

@ -914,6 +914,94 @@ _docker_build() {
}
_docker_checkpoint() {
local subcommands="
create
ls
rm
"
local aliases="
list
remove
"
__docker_subcommands "$subcommands $aliases" && return
case "$cur" in
-*)
COMPREPLY=( $( compgen -W "--help" -- "$cur" ) )
;;
*)
COMPREPLY=( $( compgen -W "$subcommands" -- "$cur" ) )
;;
esac
}
_docker_checkpoint_create() {
case "$prev" in
--checkpoint-dir)
_filedir -d
return
;;
esac
case "$cur" in
-*)
COMPREPLY=( $( compgen -W "--checkpoint-dir --help --leave-running" -- "$cur" ) )
;;
*)
local counter=$(__docker_pos_first_nonflag '--checkpoint-dir')
if [ $cword -eq $counter ]; then
__docker_complete_containers_running
fi
;;
esac
}
_docker_checkpoint_ls() {
case "$prev" in
--checkpoint-dir)
_filedir -d
return
;;
esac
case "$cur" in
-*)
COMPREPLY=( $( compgen -W "--checkpoint-dir --help" -- "$cur" ) )
;;
*)
local counter=$(__docker_pos_first_nonflag '--checkpoint-dir')
if [ $cword -eq $counter ]; then
__docker_complete_containers_all
fi
;;
esac
}
_docker_checkpoint_rm() {
case "$prev" in
--checkpoint-dir)
_filedir -d
return
;;
esac
case "$cur" in
-*)
COMPREPLY=( $( compgen -W "--checkpoint-dir --help" -- "$cur" ) )
;;
*)
local counter=$(__docker_pos_first_nonflag '--checkpoint-dir')
if [ $cword -eq $counter ]; then
__docker_complete_containers_all
elif [ $cword -eq $(($counter + 1)) ]; then
COMPREPLY=( $( compgen -W "$(__docker_q checkpoint ls "$prev" | sed 1d)" -- "$cur" ) )
fi
;;
esac
}
_docker_container() {
local subcommands="
attach
@ -1600,9 +1688,25 @@ _docker_container_run() {
_docker_container_start() {
__docker_complete_detach-keys && return
case "$prev" in
--checkpoint)
if [ __docker_is_experimental ] ; then
return
fi
;;
--checkpoint-dir)
if [ __docker_is_experimental ] ; then
_filedir -d
return
fi
;;
esac
case "$cur" in
-*)
COMPREPLY=( $( compgen -W "--attach -a --detach-keys --help --interactive -i" -- "$cur" ) )
local options="--attach -a --detach-keys --help --interactive -i"
__docker_is_experimental && options+=" --checkpoint --checkpoint-dir"
COMPREPLY=( $( compgen -W "$options" -- "$cur" ) )
;;
*)
__docker_complete_containers_stopped
@ -4097,6 +4201,7 @@ _docker() {
)
local experimental_commands=(
checkpoint
deploy
)

View file

@ -4,7 +4,7 @@
# THIS FILE DOES NOT APPLY TO SYSTEMD
#
# Please see the documentation for "systemd drop-ins":
# https://docs.docker.com/engine/articles/systemd/
# https://docs.docker.com/engine/admin/systemd/
#
# Customize location of Docker binary (especially for development testing).

View file

@ -406,11 +406,17 @@ do_install() {
( set -x; $sh_c 'sleep 3; apt-get install -y -q curl ca-certificates' )
curl='curl -sSL'
fi
if [ ! -e /usr/bin/gpg ]; then
if ! command -v gpg > /dev/null; then
apt_get_update
( set -x; $sh_c 'sleep 3; apt-get install -y -q gnupg2 || apt-get install -y -q gnupg' )
fi
# dirmngr is a separate package in ubuntu yakkety; see https://bugs.launchpad.net/ubuntu/+source/apt/+bug/1634464
if ! command -v dirmngr > /dev/null; then
apt_get_update
( set -x; $sh_c 'sleep 3; apt-get install -y -q dirmngr' )
fi
(
set -x
for key_server in $key_servers ; do

View file

@ -237,7 +237,7 @@ func (pm *Manager) save(p *v2.Plugin) error {
return errors.Wrap(err, "failed to marshal plugin json")
}
if err := ioutils.AtomicWriteFile(filepath.Join(pm.config.Root, p.GetID(), configFileName), pluginJSON, 0600); err != nil {
return err
return errors.Wrap(err, "failed to write atomically plugin json")
}
return nil
}

View file

@ -42,12 +42,12 @@ func (pm *Manager) enable(p *v2.Plugin, c *controller, force bool) error {
if p.PropagatedMount != "" {
if err := mount.MakeRShared(p.PropagatedMount); err != nil {
return err
return errors.WithStack(err)
}
}
if err := initlayer.Setup(filepath.Join(pm.config.Root, p.PluginObj.ID, rootFSFileName), 0, 0); err != nil {
return err
return errors.WithStack(err)
}
if err := pm.containerdClient.Create(p.GetID(), "", "", specs.Spec(*spec), attachToLog(p.GetID())); err != nil {
@ -56,7 +56,7 @@ func (pm *Manager) enable(p *v2.Plugin, c *controller, force bool) error {
logrus.Warnf("Could not unmount %s: %v", p.PropagatedMount, err)
}
}
return err
return errors.WithStack(err)
}
return pm.pluginPostStart(p, c)
@ -67,7 +67,7 @@ func (pm *Manager) pluginPostStart(p *v2.Plugin, c *controller) error {
if err != nil {
c.restart = false
shutdownPlugin(p, c, pm.containerdClient)
return err
return errors.WithStack(err)
}
p.SetPClient(client)

View file

@ -3,7 +3,6 @@
package v2
import (
"errors"
"os"
"path/filepath"
"strings"
@ -12,6 +11,7 @@ import (
"github.com/docker/docker/oci"
"github.com/docker/docker/pkg/system"
specs "github.com/opencontainers/runtime-spec/specs-go"
"github.com/pkg/errors"
)
// InitSpec creates an OCI spec from the plugin's config.
@ -29,7 +29,7 @@ func (p *Plugin) InitSpec(execRoot string) (*specs.Spec, error) {
execRoot = filepath.Join(execRoot, p.PluginObj.ID)
if err := os.MkdirAll(execRoot, 0700); err != nil {
return nil, err
return nil, errors.WithStack(err)
}
mounts := append(p.PluginObj.Config.Mounts, types.PluginMount{
@ -95,7 +95,7 @@ func (p *Plugin) InitSpec(execRoot string) (*specs.Spec, error) {
path := *dev.Path
d, dPermissions, err := oci.DevicesFromPath(path, path, "rwm")
if err != nil {
return nil, err
return nil, errors.WithStack(err)
}
s.Linux.Devices = append(s.Linux.Devices, d...)
s.Linux.Resources.Devices = append(s.Linux.Resources.Devices, dPermissions...)

View file

@ -1,7 +1,7 @@
# the following lines are in sorted order, FYI
github.com/Azure/go-ansiterm 388960b655244e76e24c75f48631564eaefade62
github.com/Microsoft/hcsshim v0.5.9
github.com/Microsoft/go-winio v0.3.7
github.com/Microsoft/go-winio v0.3.8
github.com/Sirupsen/logrus v0.11.0
github.com/davecgh/go-spew 6d212800a42e8ab5c146b8ace3490ee17e5225f9
github.com/docker/libtrust 9cbd2a1374f46905c68a4eb3694a130610adc62a

View file

@ -339,7 +339,7 @@ func WriteBackupStreamFromTarFile(w io.Writer, t *tar.Reader, hdr *tar.Header) (
bhdr := winio.BackupHeader{
Id: winio.BackupAlternateData,
Size: ahdr.Size,
Name: ahdr.Name[len(hdr.Name)+1:] + ":$DATA",
Name: ahdr.Name[len(hdr.Name):] + ":$DATA",
}
err = bw.WriteHeader(&bhdr)
if err != nil {