Merge pull request #699 from rhatdan/vendor

vendor in Update containers/image to add support for kpod save
This commit is contained in:
Mrunal Patel 2017-07-27 06:55:45 -07:00 committed by GitHub
commit c0bfa01c66
2 changed files with 18 additions and 9 deletions

View file

@ -5,7 +5,7 @@ k8s.io/apimachinery release-1.6 https://github.com/kubernetes/apimachinery
k8s.io/apiserver release-1.6 https://github.com/kubernetes/apiserver k8s.io/apiserver release-1.6 https://github.com/kubernetes/apiserver
# #
github.com/Sirupsen/logrus v0.11.5 github.com/Sirupsen/logrus v0.11.5
github.com/containers/image c2a797dfe5bb4a9dd7f48332ce40c6223ffba492 github.com/containers/image 106607808da3cff168be56821e994611c919d283
github.com/ostreedev/ostree-go master github.com/ostreedev/ostree-go master
github.com/containers/storage 5d8c2f87387fa5be9fa526ae39fbd79b8bdf27be github.com/containers/storage 5d8c2f87387fa5be9fa526ae39fbd79b8bdf27be
github.com/containernetworking/cni v0.4.0 github.com/containernetworking/cni v0.4.0

View file

@ -19,15 +19,24 @@ func newImageDestination(ctx *types.SystemContext, ref archiveReference) (types.
if ref.destinationRef == nil { if ref.destinationRef == nil {
return nil, errors.Errorf("docker-archive: destination reference not supplied (must be of form <path>:<reference:tag>)") return nil, errors.Errorf("docker-archive: destination reference not supplied (must be of form <path>:<reference:tag>)")
} }
fh, err := os.OpenFile(ref.path, os.O_WRONLY|os.O_EXCL|os.O_CREATE, 0644)
// ref.path can be either a pipe or a regular file
// in the case of a pipe, we require that we can open it for write
// in the case of a regular file, we don't want to overwrite any pre-existing file
// so we check for Size() == 0 below (This is racy, but using O_EXCL would also be racy,
// only in a different way. Either way, its up to the user to not have two writers to the same path.)
fh, err := os.OpenFile(ref.path, os.O_WRONLY|os.O_CREATE, 0644)
if err != nil { if err != nil {
// FIXME: It should be possible to modify archives, but the only really return nil, errors.Wrapf(err, "error opening file %q", ref.path)
// sane way of doing it is to create a copy of the image, modify }
// it and then do a rename(2).
if os.IsExist(err) { fhStat, err := fh.Stat()
err = errors.New("docker-archive doesn't support modifying existing images") if err != nil {
} return nil, errors.Wrapf(err, "error statting file %q", ref.path)
return nil, err }
if fhStat.Mode().IsRegular() && fhStat.Size() != 0 {
return nil, errors.New("docker-archive doesn't support modifying existing images")
} }
return &archiveImageDestination{ return &archiveImageDestination{