mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-12 05:21:58 +00:00
Revert "Use docker's ParseRepositoryTag when pulling"
This commit is contained in:
parent
89f18f6fe1
commit
5496686f33
49
Godeps/Godeps.json
generated
49
Godeps/Godeps.json
generated
@ -88,63 +88,58 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"ImportPath": "github.com/docker/docker/pkg/archive",
|
"ImportPath": "github.com/docker/docker/pkg/archive",
|
||||||
"Comment": "v1.4.1-1714-ged66853",
|
"Comment": "v1.4.1-656-g2115131",
|
||||||
"Rev": "ed6685369740035b0af9675bf9add52d0af7657b"
|
"Rev": "211513156dc1ace48e630b4bf4ea0fcfdc8d9abf"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"ImportPath": "github.com/docker/docker/pkg/fileutils",
|
"ImportPath": "github.com/docker/docker/pkg/fileutils",
|
||||||
"Comment": "v1.4.1-1714-ged66853",
|
"Comment": "v1.4.1-656-g2115131",
|
||||||
"Rev": "ed6685369740035b0af9675bf9add52d0af7657b"
|
"Rev": "211513156dc1ace48e630b4bf4ea0fcfdc8d9abf"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"ImportPath": "github.com/docker/docker/pkg/ioutils",
|
"ImportPath": "github.com/docker/docker/pkg/ioutils",
|
||||||
"Comment": "v1.4.1-1714-ged66853",
|
"Comment": "v1.4.1-656-g2115131",
|
||||||
"Rev": "ed6685369740035b0af9675bf9add52d0af7657b"
|
"Rev": "211513156dc1ace48e630b4bf4ea0fcfdc8d9abf"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"ImportPath": "github.com/docker/docker/pkg/mount",
|
"ImportPath": "github.com/docker/docker/pkg/mount",
|
||||||
"Comment": "v1.4.1-1714-ged66853",
|
"Comment": "v1.4.1-656-g2115131",
|
||||||
"Rev": "ed6685369740035b0af9675bf9add52d0af7657b"
|
"Rev": "211513156dc1ace48e630b4bf4ea0fcfdc8d9abf"
|
||||||
},
|
|
||||||
{
|
|
||||||
"ImportPath": "github.com/docker/docker/pkg/parsers",
|
|
||||||
"Comment": "v1.4.1-1714-ged66853",
|
|
||||||
"Rev": "ed6685369740035b0af9675bf9add52d0af7657b"
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"ImportPath": "github.com/docker/docker/pkg/pools",
|
"ImportPath": "github.com/docker/docker/pkg/pools",
|
||||||
"Comment": "v1.4.1-1714-ged66853",
|
"Comment": "v1.4.1-656-g2115131",
|
||||||
"Rev": "ed6685369740035b0af9675bf9add52d0af7657b"
|
"Rev": "211513156dc1ace48e630b4bf4ea0fcfdc8d9abf"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"ImportPath": "github.com/docker/docker/pkg/promise",
|
"ImportPath": "github.com/docker/docker/pkg/promise",
|
||||||
"Comment": "v1.4.1-1714-ged66853",
|
"Comment": "v1.4.1-656-g2115131",
|
||||||
"Rev": "ed6685369740035b0af9675bf9add52d0af7657b"
|
"Rev": "211513156dc1ace48e630b4bf4ea0fcfdc8d9abf"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"ImportPath": "github.com/docker/docker/pkg/symlink",
|
"ImportPath": "github.com/docker/docker/pkg/symlink",
|
||||||
"Comment": "v1.4.1-1714-ged66853",
|
"Comment": "v1.4.1-656-g2115131",
|
||||||
"Rev": "ed6685369740035b0af9675bf9add52d0af7657b"
|
"Rev": "211513156dc1ace48e630b4bf4ea0fcfdc8d9abf"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"ImportPath": "github.com/docker/docker/pkg/system",
|
"ImportPath": "github.com/docker/docker/pkg/system",
|
||||||
"Comment": "v1.4.1-1714-ged66853",
|
"Comment": "v1.4.1-656-g2115131",
|
||||||
"Rev": "ed6685369740035b0af9675bf9add52d0af7657b"
|
"Rev": "211513156dc1ace48e630b4bf4ea0fcfdc8d9abf"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"ImportPath": "github.com/docker/docker/pkg/term",
|
"ImportPath": "github.com/docker/docker/pkg/term",
|
||||||
"Comment": "v1.4.1-1714-ged66853",
|
"Comment": "v1.4.1-656-g2115131",
|
||||||
"Rev": "ed6685369740035b0af9675bf9add52d0af7657b"
|
"Rev": "211513156dc1ace48e630b4bf4ea0fcfdc8d9abf"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"ImportPath": "github.com/docker/docker/pkg/units",
|
"ImportPath": "github.com/docker/docker/pkg/units",
|
||||||
"Comment": "v1.4.1-1714-ged66853",
|
"Comment": "v1.4.1-656-g2115131",
|
||||||
"Rev": "ed6685369740035b0af9675bf9add52d0af7657b"
|
"Rev": "211513156dc1ace48e630b4bf4ea0fcfdc8d9abf"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"ImportPath": "github.com/docker/docker/vendor/src/code.google.com/p/go/src/pkg/archive/tar",
|
"ImportPath": "github.com/docker/docker/vendor/src/code.google.com/p/go/src/pkg/archive/tar",
|
||||||
"Comment": "v1.4.1-1714-ged66853",
|
"Comment": "v1.4.1-656-g2115131",
|
||||||
"Rev": "ed6685369740035b0af9675bf9add52d0af7657b"
|
"Rev": "211513156dc1ace48e630b4bf4ea0fcfdc8d9abf"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"ImportPath": "github.com/docker/libcontainer",
|
"ImportPath": "github.com/docker/libcontainer",
|
||||||
|
2
Godeps/_workspace/src/github.com/docker/docker/pkg/archive/MAINTAINERS
generated
vendored
Normal file
2
Godeps/_workspace/src/github.com/docker/docker/pkg/archive/MAINTAINERS
generated
vendored
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
Cristian Staretu <cristian.staretu@gmail.com> (@unclejack)
|
||||||
|
Tibor Vass <teabee89@gmail.com> (@tiborvass)
|
29
Godeps/_workspace/src/github.com/docker/docker/pkg/archive/archive.go
generated
vendored
29
Godeps/_workspace/src/github.com/docker/docker/pkg/archive/archive.go
generated
vendored
@ -101,6 +101,7 @@ func DecompressStream(archive io.Reader) (io.ReadCloser, error) {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
log.Debugf("[tar autodetect] n: %v", bs)
|
||||||
|
|
||||||
compression := DetectCompression(bs)
|
compression := DetectCompression(bs)
|
||||||
switch compression {
|
switch compression {
|
||||||
@ -172,21 +173,6 @@ type tarAppender struct {
|
|||||||
SeenFiles map[uint64]string
|
SeenFiles map[uint64]string
|
||||||
}
|
}
|
||||||
|
|
||||||
// canonicalTarName provides a platform-independent and consistent posix-style
|
|
||||||
//path for files and directories to be archived regardless of the platform.
|
|
||||||
func canonicalTarName(name string, isDir bool) (string, error) {
|
|
||||||
name, err := CanonicalTarNameForPath(name)
|
|
||||||
if err != nil {
|
|
||||||
return "", err
|
|
||||||
}
|
|
||||||
|
|
||||||
// suffix with '/' for directories
|
|
||||||
if isDir && !strings.HasSuffix(name, "/") {
|
|
||||||
name += "/"
|
|
||||||
}
|
|
||||||
return name, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (ta *tarAppender) addTarFile(path, name string) error {
|
func (ta *tarAppender) addTarFile(path, name string) error {
|
||||||
fi, err := os.Lstat(path)
|
fi, err := os.Lstat(path)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -204,12 +190,11 @@ func (ta *tarAppender) addTarFile(path, name string) error {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
hdr.Mode = int64(chmodTarEntry(os.FileMode(hdr.Mode)))
|
|
||||||
|
|
||||||
name, err = canonicalTarName(name, fi.IsDir())
|
if fi.IsDir() && !strings.HasSuffix(name, "/") {
|
||||||
if err != nil {
|
name = name + "/"
|
||||||
return fmt.Errorf("tar: cannot canonicalize path: %v", err)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
hdr.Name = name
|
hdr.Name = name
|
||||||
|
|
||||||
nlink, inode, err := setHeaderForSpecialDevice(hdr, ta, name, fi.Sys())
|
nlink, inode, err := setHeaderForSpecialDevice(hdr, ta, name, fi.Sys())
|
||||||
@ -474,7 +459,7 @@ func TarWithOptions(srcPath string, options *TarOptions) (io.ReadCloser, error)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if err := ta.addTarFile(filePath, relFilePath); err != nil {
|
if err := ta.addTarFile(filePath, relFilePath); err != nil {
|
||||||
log.Debugf("Can't add file %s to tar: %s", filePath, err)
|
log.Debugf("Can't add file %s to tar: %s", srcPath, err)
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
})
|
})
|
||||||
@ -541,7 +526,7 @@ loop:
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
if strings.HasPrefix(rel, "../") {
|
if strings.HasPrefix(rel, "..") {
|
||||||
return breakoutError(fmt.Errorf("%q is outside of %q", hdr.Name, dest))
|
return breakoutError(fmt.Errorf("%q is outside of %q", hdr.Name, dest))
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -697,8 +682,6 @@ func (archiver *Archiver) CopyFileWithTar(src, dst string) (err error) {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
hdr.Name = filepath.Base(dst)
|
hdr.Name = filepath.Base(dst)
|
||||||
hdr.Mode = int64(chmodTarEntry(os.FileMode(hdr.Mode)))
|
|
||||||
|
|
||||||
tw := tar.NewWriter(w)
|
tw := tar.NewWriter(w)
|
||||||
defer tw.Close()
|
defer tw.Close()
|
||||||
if err := tw.WriteHeader(hdr); err != nil {
|
if err := tw.WriteHeader(hdr); err != nil {
|
||||||
|
15
Godeps/_workspace/src/github.com/docker/docker/pkg/archive/archive_unix.go
generated
vendored
15
Godeps/_workspace/src/github.com/docker/docker/pkg/archive/archive_unix.go
generated
vendored
@ -4,26 +4,11 @@ package archive
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"errors"
|
"errors"
|
||||||
"os"
|
|
||||||
"syscall"
|
"syscall"
|
||||||
|
|
||||||
"github.com/docker/docker/vendor/src/code.google.com/p/go/src/pkg/archive/tar"
|
"github.com/docker/docker/vendor/src/code.google.com/p/go/src/pkg/archive/tar"
|
||||||
)
|
)
|
||||||
|
|
||||||
// canonicalTarNameForPath returns platform-specific filepath
|
|
||||||
// to canonical posix-style path for tar archival. p is relative
|
|
||||||
// path.
|
|
||||||
func CanonicalTarNameForPath(p string) (string, error) {
|
|
||||||
return p, nil // already unix-style
|
|
||||||
}
|
|
||||||
|
|
||||||
// chmodTarEntry is used to adjust the file permissions used in tar header based
|
|
||||||
// on the platform the archival is done.
|
|
||||||
|
|
||||||
func chmodTarEntry(perm os.FileMode) os.FileMode {
|
|
||||||
return perm // noop for unix as golang APIs provide perm bits correctly
|
|
||||||
}
|
|
||||||
|
|
||||||
func setHeaderForSpecialDevice(hdr *tar.Header, ta *tarAppender, name string, stat interface{}) (nlink uint32, inode uint64, err error) {
|
func setHeaderForSpecialDevice(hdr *tar.Header, ta *tarAppender, name string, stat interface{}) (nlink uint32, inode uint64, err error) {
|
||||||
s, ok := stat.(*syscall.Stat_t)
|
s, ok := stat.(*syscall.Stat_t)
|
||||||
|
|
||||||
|
30
Godeps/_workspace/src/github.com/docker/docker/pkg/archive/archive_windows.go
generated
vendored
30
Godeps/_workspace/src/github.com/docker/docker/pkg/archive/archive_windows.go
generated
vendored
@ -3,39 +3,9 @@
|
|||||||
package archive
|
package archive
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
|
||||||
"os"
|
|
||||||
"strings"
|
|
||||||
|
|
||||||
"github.com/docker/docker/vendor/src/code.google.com/p/go/src/pkg/archive/tar"
|
"github.com/docker/docker/vendor/src/code.google.com/p/go/src/pkg/archive/tar"
|
||||||
)
|
)
|
||||||
|
|
||||||
// canonicalTarNameForPath returns platform-specific filepath
|
|
||||||
// to canonical posix-style path for tar archival. p is relative
|
|
||||||
// path.
|
|
||||||
func CanonicalTarNameForPath(p string) (string, error) {
|
|
||||||
// windows: convert windows style relative path with backslashes
|
|
||||||
// into forward slashes. since windows does not allow '/' or '\'
|
|
||||||
// in file names, it is mostly safe to replace however we must
|
|
||||||
// check just in case
|
|
||||||
if strings.Contains(p, "/") {
|
|
||||||
return "", fmt.Errorf("windows path contains forward slash: %s", p)
|
|
||||||
}
|
|
||||||
return strings.Replace(p, string(os.PathSeparator), "/", -1), nil
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
// chmodTarEntry is used to adjust the file permissions used in tar header based
|
|
||||||
// on the platform the archival is done.
|
|
||||||
func chmodTarEntry(perm os.FileMode) os.FileMode {
|
|
||||||
// Clear r/w on grp/others: no precise equivalen of group/others on NTFS.
|
|
||||||
perm &= 0711
|
|
||||||
// Add the x bit: make everything +x from windows
|
|
||||||
perm |= 0100
|
|
||||||
|
|
||||||
return perm
|
|
||||||
}
|
|
||||||
|
|
||||||
func setHeaderForSpecialDevice(hdr *tar.Header, ta *tarAppender, name string, stat interface{}) (nlink uint32, inode uint64, err error) {
|
func setHeaderForSpecialDevice(hdr *tar.Header, ta *tarAppender, name string, stat interface{}) (nlink uint32, inode uint64, err error) {
|
||||||
// do nothing. no notion of Rdev, Inode, Nlink in stat on Windows
|
// do nothing. no notion of Rdev, Inode, Nlink in stat on Windows
|
||||||
return
|
return
|
||||||
|
12
Godeps/_workspace/src/github.com/docker/docker/pkg/archive/changes.go
generated
vendored
12
Godeps/_workspace/src/github.com/docker/docker/pkg/archive/changes.go
generated
vendored
@ -6,7 +6,6 @@ import (
|
|||||||
"io"
|
"io"
|
||||||
"os"
|
"os"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
"sort"
|
|
||||||
"strings"
|
"strings"
|
||||||
"syscall"
|
"syscall"
|
||||||
"time"
|
"time"
|
||||||
@ -44,13 +43,6 @@ func (change *Change) String() string {
|
|||||||
return fmt.Sprintf("%s %s", kind, change.Path)
|
return fmt.Sprintf("%s %s", kind, change.Path)
|
||||||
}
|
}
|
||||||
|
|
||||||
// for sort.Sort
|
|
||||||
type changesByPath []Change
|
|
||||||
|
|
||||||
func (c changesByPath) Less(i, j int) bool { return c[i].Path < c[j].Path }
|
|
||||||
func (c changesByPath) Len() int { return len(c) }
|
|
||||||
func (c changesByPath) Swap(i, j int) { c[j], c[i] = c[i], c[j] }
|
|
||||||
|
|
||||||
// Gnu tar and the go tar writer don't have sub-second mtime
|
// Gnu tar and the go tar writer don't have sub-second mtime
|
||||||
// precision, which is problematic when we apply changes via tar
|
// precision, which is problematic when we apply changes via tar
|
||||||
// files, we handle this by comparing for exact times, *or* same
|
// files, we handle this by comparing for exact times, *or* same
|
||||||
@ -143,7 +135,7 @@ func Changes(layers []string, rw string) ([]Change, error) {
|
|||||||
type FileInfo struct {
|
type FileInfo struct {
|
||||||
parent *FileInfo
|
parent *FileInfo
|
||||||
name string
|
name string
|
||||||
stat *system.Stat_t
|
stat *system.Stat
|
||||||
children map[string]*FileInfo
|
children map[string]*FileInfo
|
||||||
capability []byte
|
capability []byte
|
||||||
added bool
|
added bool
|
||||||
@ -381,8 +373,6 @@ func ExportChanges(dir string, changes []Change) (Archive, error) {
|
|||||||
// this buffer is needed for the duration of this piped stream
|
// this buffer is needed for the duration of this piped stream
|
||||||
defer pools.BufioWriter32KPool.Put(ta.Buffer)
|
defer pools.BufioWriter32KPool.Put(ta.Buffer)
|
||||||
|
|
||||||
sort.Sort(changesByPath(changes))
|
|
||||||
|
|
||||||
// In general we log errors here but ignore them because
|
// In general we log errors here but ignore them because
|
||||||
// during e.g. a diff operation the container can continue
|
// during e.g. a diff operation the container can continue
|
||||||
// mutating the filesystem and we can see transient errors
|
// mutating the filesystem and we can see transient errors
|
||||||
|
9
Godeps/_workspace/src/github.com/docker/docker/pkg/archive/changes_test.go
generated
vendored
9
Godeps/_workspace/src/github.com/docker/docker/pkg/archive/changes_test.go
generated
vendored
@ -25,6 +25,13 @@ func copyDir(src, dst string) error {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Helper to sort []Change by path
|
||||||
|
type byPath struct{ changes []Change }
|
||||||
|
|
||||||
|
func (b byPath) Less(i, j int) bool { return b.changes[i].Path < b.changes[j].Path }
|
||||||
|
func (b byPath) Len() int { return len(b.changes) }
|
||||||
|
func (b byPath) Swap(i, j int) { b.changes[i], b.changes[j] = b.changes[j], b.changes[i] }
|
||||||
|
|
||||||
type FileType uint32
|
type FileType uint32
|
||||||
|
|
||||||
const (
|
const (
|
||||||
@ -213,7 +220,7 @@ func TestChangesDirsMutated(t *testing.T) {
|
|||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
sort.Sort(changesByPath(changes))
|
sort.Sort(byPath{changes})
|
||||||
|
|
||||||
expectedChanges := []Change{
|
expectedChanges := []Change{
|
||||||
{"/dir1", ChangeDelete},
|
{"/dir1", ChangeDelete},
|
||||||
|
2
Godeps/_workspace/src/github.com/docker/docker/pkg/archive/diff.go
generated
vendored
2
Godeps/_workspace/src/github.com/docker/docker/pkg/archive/diff.go
generated
vendored
@ -81,7 +81,7 @@ func UnpackLayer(dest string, layer ArchiveReader) (size int64, err error) {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return 0, err
|
return 0, err
|
||||||
}
|
}
|
||||||
if strings.HasPrefix(rel, "../") {
|
if strings.HasPrefix(rel, "..") {
|
||||||
return 0, breakoutError(fmt.Errorf("%q is outside of %q", hdr.Name, dest))
|
return 0, breakoutError(fmt.Errorf("%q is outside of %q", hdr.Name, dest))
|
||||||
}
|
}
|
||||||
base := filepath.Base(path)
|
base := filepath.Base(path)
|
||||||
|
1
Godeps/_workspace/src/github.com/docker/docker/pkg/mount/MAINTAINERS
generated
vendored
Normal file
1
Godeps/_workspace/src/github.com/docker/docker/pkg/mount/MAINTAINERS
generated
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
Michael Crosby <michael@crosbymichael.com> (@crosbymichael)
|
2
Godeps/_workspace/src/github.com/docker/docker/pkg/mount/sharedsubtree_linux_test.go
generated
vendored
2
Godeps/_workspace/src/github.com/docker/docker/pkg/mount/sharedsubtree_linux_test.go
generated
vendored
@ -9,7 +9,7 @@ import (
|
|||||||
"testing"
|
"testing"
|
||||||
)
|
)
|
||||||
|
|
||||||
// nothing is propagated in or out
|
// nothing is propogated in or out
|
||||||
func TestSubtreePrivate(t *testing.T) {
|
func TestSubtreePrivate(t *testing.T) {
|
||||||
tmp := path.Join(os.TempDir(), "mount-tests")
|
tmp := path.Join(os.TempDir(), "mount-tests")
|
||||||
if err := os.MkdirAll(tmp, 0777); err != nil {
|
if err := os.MkdirAll(tmp, 0777); err != nil {
|
||||||
|
137
Godeps/_workspace/src/github.com/docker/docker/pkg/parsers/parsers.go
generated
vendored
137
Godeps/_workspace/src/github.com/docker/docker/pkg/parsers/parsers.go
generated
vendored
@ -1,137 +0,0 @@
|
|||||||
package parsers
|
|
||||||
|
|
||||||
import (
|
|
||||||
"fmt"
|
|
||||||
"strconv"
|
|
||||||
"strings"
|
|
||||||
)
|
|
||||||
|
|
||||||
// FIXME: Change this not to receive default value as parameter
|
|
||||||
func ParseHost(defaultTCPAddr, defaultUnixAddr, addr string) (string, error) {
|
|
||||||
addr = strings.TrimSpace(addr)
|
|
||||||
if addr == "" {
|
|
||||||
addr = fmt.Sprintf("unix://%s", defaultUnixAddr)
|
|
||||||
}
|
|
||||||
addrParts := strings.Split(addr, "://")
|
|
||||||
if len(addrParts) == 1 {
|
|
||||||
addrParts = []string{"tcp", addrParts[0]}
|
|
||||||
}
|
|
||||||
|
|
||||||
switch addrParts[0] {
|
|
||||||
case "tcp":
|
|
||||||
return ParseTCPAddr(addrParts[1], defaultTCPAddr)
|
|
||||||
case "unix":
|
|
||||||
return ParseUnixAddr(addrParts[1], defaultUnixAddr)
|
|
||||||
case "fd":
|
|
||||||
return addr, nil
|
|
||||||
default:
|
|
||||||
return "", fmt.Errorf("Invalid bind address format: %s", addr)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func ParseUnixAddr(addr string, defaultAddr string) (string, error) {
|
|
||||||
addr = strings.TrimPrefix(addr, "unix://")
|
|
||||||
if strings.Contains(addr, "://") {
|
|
||||||
return "", fmt.Errorf("Invalid proto, expected unix: %s", addr)
|
|
||||||
}
|
|
||||||
if addr == "" {
|
|
||||||
addr = defaultAddr
|
|
||||||
}
|
|
||||||
return fmt.Sprintf("unix://%s", addr), nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func ParseTCPAddr(addr string, defaultAddr string) (string, error) {
|
|
||||||
addr = strings.TrimPrefix(addr, "tcp://")
|
|
||||||
if strings.Contains(addr, "://") || addr == "" {
|
|
||||||
return "", fmt.Errorf("Invalid proto, expected tcp: %s", addr)
|
|
||||||
}
|
|
||||||
|
|
||||||
hostParts := strings.Split(addr, ":")
|
|
||||||
if len(hostParts) != 2 {
|
|
||||||
return "", fmt.Errorf("Invalid bind address format: %s", addr)
|
|
||||||
}
|
|
||||||
host := hostParts[0]
|
|
||||||
if host == "" {
|
|
||||||
host = defaultAddr
|
|
||||||
}
|
|
||||||
|
|
||||||
p, err := strconv.Atoi(hostParts[1])
|
|
||||||
if err != nil && p == 0 {
|
|
||||||
return "", fmt.Errorf("Invalid bind address format: %s", addr)
|
|
||||||
}
|
|
||||||
return fmt.Sprintf("tcp://%s:%d", host, p), nil
|
|
||||||
}
|
|
||||||
|
|
||||||
// Get a repos name and returns the right reposName + tag|digest
|
|
||||||
// The tag can be confusing because of a port in a repository name.
|
|
||||||
// Ex: localhost.localdomain:5000/samalba/hipache:latest
|
|
||||||
// Digest ex: localhost:5000/foo/bar@sha256:bc8813ea7b3603864987522f02a76101c17ad122e1c46d790efc0fca78ca7bfb
|
|
||||||
func ParseRepositoryTag(repos string) (string, string) {
|
|
||||||
n := strings.Index(repos, "@")
|
|
||||||
if n >= 0 {
|
|
||||||
parts := strings.Split(repos, "@")
|
|
||||||
return parts[0], parts[1]
|
|
||||||
}
|
|
||||||
n = strings.LastIndex(repos, ":")
|
|
||||||
if n < 0 {
|
|
||||||
return repos, ""
|
|
||||||
}
|
|
||||||
if tag := repos[n+1:]; !strings.Contains(tag, "/") {
|
|
||||||
return repos[:n], tag
|
|
||||||
}
|
|
||||||
return repos, ""
|
|
||||||
}
|
|
||||||
|
|
||||||
func PartParser(template, data string) (map[string]string, error) {
|
|
||||||
// ip:public:private
|
|
||||||
var (
|
|
||||||
templateParts = strings.Split(template, ":")
|
|
||||||
parts = strings.Split(data, ":")
|
|
||||||
out = make(map[string]string, len(templateParts))
|
|
||||||
)
|
|
||||||
if len(parts) != len(templateParts) {
|
|
||||||
return nil, fmt.Errorf("Invalid format to parse. %s should match template %s", data, template)
|
|
||||||
}
|
|
||||||
|
|
||||||
for i, t := range templateParts {
|
|
||||||
value := ""
|
|
||||||
if len(parts) > i {
|
|
||||||
value = parts[i]
|
|
||||||
}
|
|
||||||
out[t] = value
|
|
||||||
}
|
|
||||||
return out, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func ParseKeyValueOpt(opt string) (string, string, error) {
|
|
||||||
parts := strings.SplitN(opt, "=", 2)
|
|
||||||
if len(parts) != 2 {
|
|
||||||
return "", "", fmt.Errorf("Unable to parse key/value option: %s", opt)
|
|
||||||
}
|
|
||||||
return strings.TrimSpace(parts[0]), strings.TrimSpace(parts[1]), nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func ParsePortRange(ports string) (uint64, uint64, error) {
|
|
||||||
if ports == "" {
|
|
||||||
return 0, 0, fmt.Errorf("Empty string specified for ports.")
|
|
||||||
}
|
|
||||||
if !strings.Contains(ports, "-") {
|
|
||||||
start, err := strconv.ParseUint(ports, 10, 16)
|
|
||||||
end := start
|
|
||||||
return start, end, err
|
|
||||||
}
|
|
||||||
|
|
||||||
parts := strings.Split(ports, "-")
|
|
||||||
start, err := strconv.ParseUint(parts[0], 10, 16)
|
|
||||||
if err != nil {
|
|
||||||
return 0, 0, err
|
|
||||||
}
|
|
||||||
end, err := strconv.ParseUint(parts[1], 10, 16)
|
|
||||||
if err != nil {
|
|
||||||
return 0, 0, err
|
|
||||||
}
|
|
||||||
if end < start {
|
|
||||||
return 0, 0, fmt.Errorf("Invalid range specified for the Port: %s", ports)
|
|
||||||
}
|
|
||||||
return start, end, nil
|
|
||||||
}
|
|
3
Godeps/_workspace/src/github.com/docker/docker/pkg/symlink/MAINTAINERS
generated
vendored
Normal file
3
Godeps/_workspace/src/github.com/docker/docker/pkg/symlink/MAINTAINERS
generated
vendored
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
Tibor Vass <teabee89@gmail.com> (@tiborvass)
|
||||||
|
Cristian Staretu <cristian.staretu@gmail.com> (@unclejack)
|
||||||
|
Tianon Gravi <admwiggin@gmail.com> (@tianon)
|
2
Godeps/_workspace/src/github.com/docker/docker/pkg/system/MAINTAINERS
generated
vendored
Normal file
2
Godeps/_workspace/src/github.com/docker/docker/pkg/system/MAINTAINERS
generated
vendored
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
Michael Crosby <michael@crosbymichael.com> (@crosbymichael)
|
||||||
|
Victor Vieux <vieux@docker.com> (@vieux)
|
2
Godeps/_workspace/src/github.com/docker/docker/pkg/system/lstat.go
generated
vendored
2
Godeps/_workspace/src/github.com/docker/docker/pkg/system/lstat.go
generated
vendored
@ -6,7 +6,7 @@ import (
|
|||||||
"syscall"
|
"syscall"
|
||||||
)
|
)
|
||||||
|
|
||||||
func Lstat(path string) (*Stat_t, error) {
|
func Lstat(path string) (*Stat, error) {
|
||||||
s := &syscall.Stat_t{}
|
s := &syscall.Stat_t{}
|
||||||
err := syscall.Lstat(path, s)
|
err := syscall.Lstat(path, s)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
2
Godeps/_workspace/src/github.com/docker/docker/pkg/system/lstat_windows.go
generated
vendored
2
Godeps/_workspace/src/github.com/docker/docker/pkg/system/lstat_windows.go
generated
vendored
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
package system
|
package system
|
||||||
|
|
||||||
func Lstat(path string) (*Stat_t, error) {
|
func Lstat(path string) (*Stat, error) {
|
||||||
// should not be called on cli code path
|
// should not be called on cli code path
|
||||||
return nil, ErrNotSupportedPlatform
|
return nil, ErrNotSupportedPlatform
|
||||||
}
|
}
|
||||||
|
16
Godeps/_workspace/src/github.com/docker/docker/pkg/system/stat.go
generated
vendored
16
Godeps/_workspace/src/github.com/docker/docker/pkg/system/stat.go
generated
vendored
@ -4,7 +4,7 @@ import (
|
|||||||
"syscall"
|
"syscall"
|
||||||
)
|
)
|
||||||
|
|
||||||
type Stat_t struct {
|
type Stat struct {
|
||||||
mode uint32
|
mode uint32
|
||||||
uid uint32
|
uid uint32
|
||||||
gid uint32
|
gid uint32
|
||||||
@ -13,30 +13,30 @@ type Stat_t struct {
|
|||||||
mtim syscall.Timespec
|
mtim syscall.Timespec
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s Stat_t) Mode() uint32 {
|
func (s Stat) Mode() uint32 {
|
||||||
return s.mode
|
return s.mode
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s Stat_t) Uid() uint32 {
|
func (s Stat) Uid() uint32 {
|
||||||
return s.uid
|
return s.uid
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s Stat_t) Gid() uint32 {
|
func (s Stat) Gid() uint32 {
|
||||||
return s.gid
|
return s.gid
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s Stat_t) Rdev() uint64 {
|
func (s Stat) Rdev() uint64 {
|
||||||
return s.rdev
|
return s.rdev
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s Stat_t) Size() int64 {
|
func (s Stat) Size() int64 {
|
||||||
return s.size
|
return s.size
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s Stat_t) Mtim() syscall.Timespec {
|
func (s Stat) Mtim() syscall.Timespec {
|
||||||
return s.mtim
|
return s.mtim
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s Stat_t) GetLastModification() syscall.Timespec {
|
func (s Stat) GetLastModification() syscall.Timespec {
|
||||||
return s.Mtim()
|
return s.Mtim()
|
||||||
}
|
}
|
||||||
|
13
Godeps/_workspace/src/github.com/docker/docker/pkg/system/stat_linux.go
generated
vendored
13
Godeps/_workspace/src/github.com/docker/docker/pkg/system/stat_linux.go
generated
vendored
@ -4,20 +4,11 @@ import (
|
|||||||
"syscall"
|
"syscall"
|
||||||
)
|
)
|
||||||
|
|
||||||
func fromStatT(s *syscall.Stat_t) (*Stat_t, error) {
|
func fromStatT(s *syscall.Stat_t) (*Stat, error) {
|
||||||
return &Stat_t{size: s.Size,
|
return &Stat{size: s.Size,
|
||||||
mode: s.Mode,
|
mode: s.Mode,
|
||||||
uid: s.Uid,
|
uid: s.Uid,
|
||||||
gid: s.Gid,
|
gid: s.Gid,
|
||||||
rdev: s.Rdev,
|
rdev: s.Rdev,
|
||||||
mtim: s.Mtim}, nil
|
mtim: s.Mtim}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func Stat(path string) (*Stat_t, error) {
|
|
||||||
s := &syscall.Stat_t{}
|
|
||||||
err := syscall.Stat(path, s)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
return fromStatT(s)
|
|
||||||
}
|
|
||||||
|
4
Godeps/_workspace/src/github.com/docker/docker/pkg/system/stat_unsupported.go
generated
vendored
4
Godeps/_workspace/src/github.com/docker/docker/pkg/system/stat_unsupported.go
generated
vendored
@ -6,8 +6,8 @@ import (
|
|||||||
"syscall"
|
"syscall"
|
||||||
)
|
)
|
||||||
|
|
||||||
func fromStatT(s *syscall.Stat_t) (*Stat_t, error) {
|
func fromStatT(s *syscall.Stat_t) (*Stat, error) {
|
||||||
return &Stat_t{size: s.Size,
|
return &Stat{size: s.Size,
|
||||||
mode: uint32(s.Mode),
|
mode: uint32(s.Mode),
|
||||||
uid: s.Uid,
|
uid: s.Uid,
|
||||||
gid: s.Gid,
|
gid: s.Gid,
|
||||||
|
7
Godeps/_workspace/src/github.com/docker/docker/pkg/system/stat_windows.go
generated
vendored
7
Godeps/_workspace/src/github.com/docker/docker/pkg/system/stat_windows.go
generated
vendored
@ -7,11 +7,6 @@ import (
|
|||||||
"syscall"
|
"syscall"
|
||||||
)
|
)
|
||||||
|
|
||||||
func fromStatT(s *syscall.Win32FileAttributeData) (*Stat_t, error) {
|
func fromStatT(s *syscall.Win32FileAttributeData) (*Stat, error) {
|
||||||
return nil, errors.New("fromStatT should not be called on windows path")
|
return nil, errors.New("fromStatT should not be called on windows path")
|
||||||
}
|
}
|
||||||
|
|
||||||
func Stat(path string) (*Stat_t, error) {
|
|
||||||
// should not be called on cli code path
|
|
||||||
return nil, ErrNotSupportedPlatform
|
|
||||||
}
|
|
||||||
|
1
Godeps/_workspace/src/github.com/docker/docker/pkg/term/MAINTAINERS
generated
vendored
Normal file
1
Godeps/_workspace/src/github.com/docker/docker/pkg/term/MAINTAINERS
generated
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
Solomon Hykes <solomon@docker.com> (@shykes)
|
2
Godeps/_workspace/src/github.com/docker/docker/pkg/units/MAINTAINERS
generated
vendored
Normal file
2
Godeps/_workspace/src/github.com/docker/docker/pkg/units/MAINTAINERS
generated
vendored
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
Victor Vieux <vieux@docker.com> (@vieux)
|
||||||
|
Jessie Frazelle <jess@docker.com> (@jfrazelle)
|
@ -35,7 +35,6 @@ import (
|
|||||||
"github.com/GoogleCloudPlatform/kubernetes/pkg/kubelet/leaky"
|
"github.com/GoogleCloudPlatform/kubernetes/pkg/kubelet/leaky"
|
||||||
"github.com/GoogleCloudPlatform/kubernetes/pkg/types"
|
"github.com/GoogleCloudPlatform/kubernetes/pkg/types"
|
||||||
"github.com/GoogleCloudPlatform/kubernetes/pkg/util"
|
"github.com/GoogleCloudPlatform/kubernetes/pkg/util"
|
||||||
"github.com/docker/docker/pkg/parsers"
|
|
||||||
docker "github.com/fsouza/go-dockerclient"
|
docker "github.com/fsouza/go-dockerclient"
|
||||||
"github.com/golang/glog"
|
"github.com/golang/glog"
|
||||||
)
|
)
|
||||||
@ -326,7 +325,7 @@ func NewDockerContainerCommandRunner(client DockerInterface) ContainerCommandRun
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (p dockerPuller) Pull(image string) error {
|
func (p dockerPuller) Pull(image string) error {
|
||||||
_, tag := parsers.ParseRepositoryTag(image)
|
image, tag := parseImageName(image)
|
||||||
|
|
||||||
// If no tag was specified, use the default "latest".
|
// If no tag was specified, use the default "latest".
|
||||||
if len(tag) == 0 {
|
if len(tag) == 0 {
|
||||||
@ -380,6 +379,16 @@ func (p dockerPuller) IsImagePresent(image string) (bool, error) {
|
|||||||
return false, err
|
return false, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// RequireLatestImage returns if the user wants the latest image
|
||||||
|
func RequireLatestImage(name string) bool {
|
||||||
|
_, tag := parseImageName(name)
|
||||||
|
|
||||||
|
if tag == "latest" {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
func (p throttledDockerPuller) IsImagePresent(name string) (bool, error) {
|
func (p throttledDockerPuller) IsImagePresent(name string) (bool, error) {
|
||||||
return p.puller.IsImagePresent(name)
|
return p.puller.IsImagePresent(name)
|
||||||
}
|
}
|
||||||
@ -762,6 +771,29 @@ func GetRunningContainers(client DockerInterface, ids []string) ([]*docker.Conta
|
|||||||
return result, nil
|
return result, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Parses image name including a tag and returns image name and tag.
|
||||||
|
// TODO: Future Docker versions can parse the tag on daemon side, see
|
||||||
|
// https://github.com/dotcloud/docker/issues/6876
|
||||||
|
// So this can be deprecated at some point.
|
||||||
|
func parseImageName(image string) (string, string) {
|
||||||
|
tag := ""
|
||||||
|
parts := strings.SplitN(image, "/", 2)
|
||||||
|
repo := ""
|
||||||
|
if len(parts) == 2 {
|
||||||
|
repo = parts[0]
|
||||||
|
image = parts[1]
|
||||||
|
}
|
||||||
|
parts = strings.SplitN(image, ":", 2)
|
||||||
|
if len(parts) == 2 {
|
||||||
|
image = parts[0]
|
||||||
|
tag = parts[1]
|
||||||
|
}
|
||||||
|
if repo != "" {
|
||||||
|
image = fmt.Sprintf("%s/%s", repo, image)
|
||||||
|
}
|
||||||
|
return image, tag
|
||||||
|
}
|
||||||
|
|
||||||
// Get a docker endpoint, either from the string passed in, or $DOCKER_HOST environment variables
|
// Get a docker endpoint, either from the string passed in, or $DOCKER_HOST environment variables
|
||||||
func getDockerEndpoint(dockerEndpoint string) string {
|
func getDockerEndpoint(dockerEndpoint string) string {
|
||||||
var endpoint string
|
var endpoint string
|
||||||
|
@ -179,6 +179,29 @@ func TestDockerContainerCommand(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var parseImageNameTests = []struct {
|
||||||
|
imageName string
|
||||||
|
name string
|
||||||
|
tag string
|
||||||
|
}{
|
||||||
|
{"ubuntu", "ubuntu", ""},
|
||||||
|
{"ubuntu:2342", "ubuntu", "2342"},
|
||||||
|
{"ubuntu:latest", "ubuntu", "latest"},
|
||||||
|
{"foo/bar:445566", "foo/bar", "445566"},
|
||||||
|
{"registry.example.com:5000/foobar", "registry.example.com:5000/foobar", ""},
|
||||||
|
{"registry.example.com:5000/foobar:5342", "registry.example.com:5000/foobar", "5342"},
|
||||||
|
{"registry.example.com:5000/foobar:latest", "registry.example.com:5000/foobar", "latest"},
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestParseImageName(t *testing.T) {
|
||||||
|
for _, tt := range parseImageNameTests {
|
||||||
|
name, tag := parseImageName(tt.imageName)
|
||||||
|
if name != tt.name || tag != tt.tag {
|
||||||
|
t.Errorf("Expected name/tag: %s/%s, got %s/%s", tt.name, tt.tag, name, tag)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
func TestDockerKeyringLookupFails(t *testing.T) {
|
func TestDockerKeyringLookupFails(t *testing.T) {
|
||||||
fakeKeyring := &credentialprovider.FakeKeyring{}
|
fakeKeyring := &credentialprovider.FakeKeyring{}
|
||||||
fakeClient := &FakeDockerClient{
|
fakeClient := &FakeDockerClient{
|
||||||
@ -194,7 +217,7 @@ func TestDockerKeyringLookupFails(t *testing.T) {
|
|||||||
if err == nil {
|
if err == nil {
|
||||||
t.Errorf("unexpected non-error")
|
t.Errorf("unexpected non-error")
|
||||||
}
|
}
|
||||||
msg := "image pull failed for host/repository/image:version, this may be because there are no credentials on this request. details: (test error)"
|
msg := "image pull failed for host/repository/image, this may be because there are no credentials on this request. details: (test error)"
|
||||||
if err.Error() != msg {
|
if err.Error() != msg {
|
||||||
t.Errorf("expected: %s, saw: %s", msg, err.Error())
|
t.Errorf("expected: %s, saw: %s", msg, err.Error())
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user