diff --git a/Godeps/Godeps.json b/Godeps/Godeps.json index 0588493e94d..1d40422c3ac 100644 --- a/Godeps/Godeps.json +++ b/Godeps/Godeps.json @@ -88,63 +88,58 @@ }, { "ImportPath": "github.com/docker/docker/pkg/archive", - "Comment": "v1.4.1-1714-ged66853", - "Rev": "ed6685369740035b0af9675bf9add52d0af7657b" + "Comment": "v1.4.1-656-g2115131", + "Rev": "211513156dc1ace48e630b4bf4ea0fcfdc8d9abf" }, { "ImportPath": "github.com/docker/docker/pkg/fileutils", - "Comment": "v1.4.1-1714-ged66853", - "Rev": "ed6685369740035b0af9675bf9add52d0af7657b" + "Comment": "v1.4.1-656-g2115131", + "Rev": "211513156dc1ace48e630b4bf4ea0fcfdc8d9abf" }, { "ImportPath": "github.com/docker/docker/pkg/ioutils", - "Comment": "v1.4.1-1714-ged66853", - "Rev": "ed6685369740035b0af9675bf9add52d0af7657b" + "Comment": "v1.4.1-656-g2115131", + "Rev": "211513156dc1ace48e630b4bf4ea0fcfdc8d9abf" }, { "ImportPath": "github.com/docker/docker/pkg/mount", - "Comment": "v1.4.1-1714-ged66853", - "Rev": "ed6685369740035b0af9675bf9add52d0af7657b" - }, - { - "ImportPath": "github.com/docker/docker/pkg/parsers", - "Comment": "v1.4.1-1714-ged66853", - "Rev": "ed6685369740035b0af9675bf9add52d0af7657b" + "Comment": "v1.4.1-656-g2115131", + "Rev": "211513156dc1ace48e630b4bf4ea0fcfdc8d9abf" }, { "ImportPath": "github.com/docker/docker/pkg/pools", - "Comment": "v1.4.1-1714-ged66853", - "Rev": "ed6685369740035b0af9675bf9add52d0af7657b" + "Comment": "v1.4.1-656-g2115131", + "Rev": "211513156dc1ace48e630b4bf4ea0fcfdc8d9abf" }, { "ImportPath": "github.com/docker/docker/pkg/promise", - "Comment": "v1.4.1-1714-ged66853", - "Rev": "ed6685369740035b0af9675bf9add52d0af7657b" + "Comment": "v1.4.1-656-g2115131", + "Rev": "211513156dc1ace48e630b4bf4ea0fcfdc8d9abf" }, { "ImportPath": "github.com/docker/docker/pkg/symlink", - "Comment": "v1.4.1-1714-ged66853", - "Rev": "ed6685369740035b0af9675bf9add52d0af7657b" + "Comment": "v1.4.1-656-g2115131", + "Rev": "211513156dc1ace48e630b4bf4ea0fcfdc8d9abf" }, { "ImportPath": "github.com/docker/docker/pkg/system", - "Comment": "v1.4.1-1714-ged66853", - "Rev": "ed6685369740035b0af9675bf9add52d0af7657b" + "Comment": "v1.4.1-656-g2115131", + "Rev": "211513156dc1ace48e630b4bf4ea0fcfdc8d9abf" }, { "ImportPath": "github.com/docker/docker/pkg/term", - "Comment": "v1.4.1-1714-ged66853", - "Rev": "ed6685369740035b0af9675bf9add52d0af7657b" + "Comment": "v1.4.1-656-g2115131", + "Rev": "211513156dc1ace48e630b4bf4ea0fcfdc8d9abf" }, { "ImportPath": "github.com/docker/docker/pkg/units", - "Comment": "v1.4.1-1714-ged66853", - "Rev": "ed6685369740035b0af9675bf9add52d0af7657b" + "Comment": "v1.4.1-656-g2115131", + "Rev": "211513156dc1ace48e630b4bf4ea0fcfdc8d9abf" }, { "ImportPath": "github.com/docker/docker/vendor/src/code.google.com/p/go/src/pkg/archive/tar", - "Comment": "v1.4.1-1714-ged66853", - "Rev": "ed6685369740035b0af9675bf9add52d0af7657b" + "Comment": "v1.4.1-656-g2115131", + "Rev": "211513156dc1ace48e630b4bf4ea0fcfdc8d9abf" }, { "ImportPath": "github.com/docker/libcontainer", diff --git a/Godeps/_workspace/src/github.com/docker/docker/pkg/archive/MAINTAINERS b/Godeps/_workspace/src/github.com/docker/docker/pkg/archive/MAINTAINERS new file mode 100644 index 00000000000..2aac7265d23 --- /dev/null +++ b/Godeps/_workspace/src/github.com/docker/docker/pkg/archive/MAINTAINERS @@ -0,0 +1,2 @@ +Cristian Staretu (@unclejack) +Tibor Vass (@tiborvass) diff --git a/Godeps/_workspace/src/github.com/docker/docker/pkg/archive/archive.go b/Godeps/_workspace/src/github.com/docker/docker/pkg/archive/archive.go index bfa6e18462f..35566520b1c 100644 --- a/Godeps/_workspace/src/github.com/docker/docker/pkg/archive/archive.go +++ b/Godeps/_workspace/src/github.com/docker/docker/pkg/archive/archive.go @@ -101,6 +101,7 @@ func DecompressStream(archive io.Reader) (io.ReadCloser, error) { if err != nil { return nil, err } + log.Debugf("[tar autodetect] n: %v", bs) compression := DetectCompression(bs) switch compression { @@ -172,21 +173,6 @@ type tarAppender struct { 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 { fi, err := os.Lstat(path) if err != nil { @@ -204,12 +190,11 @@ func (ta *tarAppender) addTarFile(path, name string) error { if err != nil { return err } - hdr.Mode = int64(chmodTarEntry(os.FileMode(hdr.Mode))) - name, err = canonicalTarName(name, fi.IsDir()) - if err != nil { - return fmt.Errorf("tar: cannot canonicalize path: %v", err) + if fi.IsDir() && !strings.HasSuffix(name, "/") { + name = name + "/" } + hdr.Name = name 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 { - 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 }) @@ -541,7 +526,7 @@ loop: if err != nil { return err } - if strings.HasPrefix(rel, "../") { + if strings.HasPrefix(rel, "..") { 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 } hdr.Name = filepath.Base(dst) - hdr.Mode = int64(chmodTarEntry(os.FileMode(hdr.Mode))) - tw := tar.NewWriter(w) defer tw.Close() if err := tw.WriteHeader(hdr); err != nil { diff --git a/Godeps/_workspace/src/github.com/docker/docker/pkg/archive/archive_unix.go b/Godeps/_workspace/src/github.com/docker/docker/pkg/archive/archive_unix.go index cbce65e31d4..c0e8aee93cf 100644 --- a/Godeps/_workspace/src/github.com/docker/docker/pkg/archive/archive_unix.go +++ b/Godeps/_workspace/src/github.com/docker/docker/pkg/archive/archive_unix.go @@ -4,26 +4,11 @@ package archive import ( "errors" - "os" "syscall" "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) { s, ok := stat.(*syscall.Stat_t) diff --git a/Godeps/_workspace/src/github.com/docker/docker/pkg/archive/archive_windows.go b/Godeps/_workspace/src/github.com/docker/docker/pkg/archive/archive_windows.go index 96a93ee7af9..3cc2493f6f2 100644 --- a/Godeps/_workspace/src/github.com/docker/docker/pkg/archive/archive_windows.go +++ b/Godeps/_workspace/src/github.com/docker/docker/pkg/archive/archive_windows.go @@ -3,39 +3,9 @@ package archive import ( - "fmt" - "os" - "strings" - "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) { // do nothing. no notion of Rdev, Inode, Nlink in stat on Windows return diff --git a/Godeps/_workspace/src/github.com/docker/docker/pkg/archive/changes.go b/Godeps/_workspace/src/github.com/docker/docker/pkg/archive/changes.go index f2ac2a3561d..85217f6e088 100644 --- a/Godeps/_workspace/src/github.com/docker/docker/pkg/archive/changes.go +++ b/Godeps/_workspace/src/github.com/docker/docker/pkg/archive/changes.go @@ -6,7 +6,6 @@ import ( "io" "os" "path/filepath" - "sort" "strings" "syscall" "time" @@ -44,13 +43,6 @@ func (change *Change) String() string { 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 // precision, which is problematic when we apply changes via tar // 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 { parent *FileInfo name string - stat *system.Stat_t + stat *system.Stat children map[string]*FileInfo capability []byte 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 defer pools.BufioWriter32KPool.Put(ta.Buffer) - sort.Sort(changesByPath(changes)) - // In general we log errors here but ignore them because // during e.g. a diff operation the container can continue // mutating the filesystem and we can see transient errors diff --git a/Godeps/_workspace/src/github.com/docker/docker/pkg/archive/changes_test.go b/Godeps/_workspace/src/github.com/docker/docker/pkg/archive/changes_test.go index 8f32d7b30ea..6b8f2354b8a 100644 --- a/Godeps/_workspace/src/github.com/docker/docker/pkg/archive/changes_test.go +++ b/Godeps/_workspace/src/github.com/docker/docker/pkg/archive/changes_test.go @@ -25,6 +25,13 @@ func copyDir(src, dst string) error { 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 const ( @@ -213,7 +220,7 @@ func TestChangesDirsMutated(t *testing.T) { t.Fatal(err) } - sort.Sort(changesByPath(changes)) + sort.Sort(byPath{changes}) expectedChanges := []Change{ {"/dir1", ChangeDelete}, diff --git a/Godeps/_workspace/src/github.com/docker/docker/pkg/archive/diff.go b/Godeps/_workspace/src/github.com/docker/docker/pkg/archive/diff.go index b5eb63fd442..ca282071f5c 100644 --- a/Godeps/_workspace/src/github.com/docker/docker/pkg/archive/diff.go +++ b/Godeps/_workspace/src/github.com/docker/docker/pkg/archive/diff.go @@ -81,7 +81,7 @@ func UnpackLayer(dest string, layer ArchiveReader) (size int64, err error) { if err != nil { return 0, err } - if strings.HasPrefix(rel, "../") { + if strings.HasPrefix(rel, "..") { return 0, breakoutError(fmt.Errorf("%q is outside of %q", hdr.Name, dest)) } base := filepath.Base(path) diff --git a/Godeps/_workspace/src/github.com/docker/docker/pkg/mount/MAINTAINERS b/Godeps/_workspace/src/github.com/docker/docker/pkg/mount/MAINTAINERS new file mode 100644 index 00000000000..1e998f8ac1a --- /dev/null +++ b/Godeps/_workspace/src/github.com/docker/docker/pkg/mount/MAINTAINERS @@ -0,0 +1 @@ +Michael Crosby (@crosbymichael) diff --git a/Godeps/_workspace/src/github.com/docker/docker/pkg/mount/sharedsubtree_linux_test.go b/Godeps/_workspace/src/github.com/docker/docker/pkg/mount/sharedsubtree_linux_test.go index da9aa15015a..0986bd9c75d 100644 --- a/Godeps/_workspace/src/github.com/docker/docker/pkg/mount/sharedsubtree_linux_test.go +++ b/Godeps/_workspace/src/github.com/docker/docker/pkg/mount/sharedsubtree_linux_test.go @@ -9,7 +9,7 @@ import ( "testing" ) -// nothing is propagated in or out +// nothing is propogated in or out func TestSubtreePrivate(t *testing.T) { tmp := path.Join(os.TempDir(), "mount-tests") if err := os.MkdirAll(tmp, 0777); err != nil { diff --git a/Godeps/_workspace/src/github.com/docker/docker/pkg/parsers/parsers.go b/Godeps/_workspace/src/github.com/docker/docker/pkg/parsers/parsers.go deleted file mode 100644 index 59e294dc225..00000000000 --- a/Godeps/_workspace/src/github.com/docker/docker/pkg/parsers/parsers.go +++ /dev/null @@ -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 -} diff --git a/Godeps/_workspace/src/github.com/docker/docker/pkg/symlink/MAINTAINERS b/Godeps/_workspace/src/github.com/docker/docker/pkg/symlink/MAINTAINERS new file mode 100644 index 00000000000..51a41a5b605 --- /dev/null +++ b/Godeps/_workspace/src/github.com/docker/docker/pkg/symlink/MAINTAINERS @@ -0,0 +1,3 @@ +Tibor Vass (@tiborvass) +Cristian Staretu (@unclejack) +Tianon Gravi (@tianon) diff --git a/Godeps/_workspace/src/github.com/docker/docker/pkg/system/MAINTAINERS b/Godeps/_workspace/src/github.com/docker/docker/pkg/system/MAINTAINERS new file mode 100644 index 00000000000..68a97d2fc24 --- /dev/null +++ b/Godeps/_workspace/src/github.com/docker/docker/pkg/system/MAINTAINERS @@ -0,0 +1,2 @@ +Michael Crosby (@crosbymichael) +Victor Vieux (@vieux) diff --git a/Godeps/_workspace/src/github.com/docker/docker/pkg/system/lstat.go b/Godeps/_workspace/src/github.com/docker/docker/pkg/system/lstat.go index 6c1ed2e3864..9ef82d55237 100644 --- a/Godeps/_workspace/src/github.com/docker/docker/pkg/system/lstat.go +++ b/Godeps/_workspace/src/github.com/docker/docker/pkg/system/lstat.go @@ -6,7 +6,7 @@ import ( "syscall" ) -func Lstat(path string) (*Stat_t, error) { +func Lstat(path string) (*Stat, error) { s := &syscall.Stat_t{} err := syscall.Lstat(path, s) if err != nil { diff --git a/Godeps/_workspace/src/github.com/docker/docker/pkg/system/lstat_windows.go b/Godeps/_workspace/src/github.com/docker/docker/pkg/system/lstat_windows.go index 801e756d8b9..213a7c7ade3 100644 --- a/Godeps/_workspace/src/github.com/docker/docker/pkg/system/lstat_windows.go +++ b/Godeps/_workspace/src/github.com/docker/docker/pkg/system/lstat_windows.go @@ -2,7 +2,7 @@ package system -func Lstat(path string) (*Stat_t, error) { +func Lstat(path string) (*Stat, error) { // should not be called on cli code path return nil, ErrNotSupportedPlatform } diff --git a/Godeps/_workspace/src/github.com/docker/docker/pkg/system/stat.go b/Godeps/_workspace/src/github.com/docker/docker/pkg/system/stat.go index 186e85287d4..5d47494d212 100644 --- a/Godeps/_workspace/src/github.com/docker/docker/pkg/system/stat.go +++ b/Godeps/_workspace/src/github.com/docker/docker/pkg/system/stat.go @@ -4,7 +4,7 @@ import ( "syscall" ) -type Stat_t struct { +type Stat struct { mode uint32 uid uint32 gid uint32 @@ -13,30 +13,30 @@ type Stat_t struct { mtim syscall.Timespec } -func (s Stat_t) Mode() uint32 { +func (s Stat) Mode() uint32 { return s.mode } -func (s Stat_t) Uid() uint32 { +func (s Stat) Uid() uint32 { return s.uid } -func (s Stat_t) Gid() uint32 { +func (s Stat) Gid() uint32 { return s.gid } -func (s Stat_t) Rdev() uint64 { +func (s Stat) Rdev() uint64 { return s.rdev } -func (s Stat_t) Size() int64 { +func (s Stat) Size() int64 { return s.size } -func (s Stat_t) Mtim() syscall.Timespec { +func (s Stat) Mtim() syscall.Timespec { return s.mtim } -func (s Stat_t) GetLastModification() syscall.Timespec { +func (s Stat) GetLastModification() syscall.Timespec { return s.Mtim() } diff --git a/Godeps/_workspace/src/github.com/docker/docker/pkg/system/stat_linux.go b/Godeps/_workspace/src/github.com/docker/docker/pkg/system/stat_linux.go index 072728d0a18..47cebef5cf1 100644 --- a/Godeps/_workspace/src/github.com/docker/docker/pkg/system/stat_linux.go +++ b/Godeps/_workspace/src/github.com/docker/docker/pkg/system/stat_linux.go @@ -4,20 +4,11 @@ import ( "syscall" ) -func fromStatT(s *syscall.Stat_t) (*Stat_t, error) { - return &Stat_t{size: s.Size, +func fromStatT(s *syscall.Stat_t) (*Stat, error) { + return &Stat{size: s.Size, mode: s.Mode, uid: s.Uid, gid: s.Gid, rdev: s.Rdev, 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) -} diff --git a/Godeps/_workspace/src/github.com/docker/docker/pkg/system/stat_unsupported.go b/Godeps/_workspace/src/github.com/docker/docker/pkg/system/stat_unsupported.go index 66323eee21d..c4d53e6cd61 100644 --- a/Godeps/_workspace/src/github.com/docker/docker/pkg/system/stat_unsupported.go +++ b/Godeps/_workspace/src/github.com/docker/docker/pkg/system/stat_unsupported.go @@ -6,8 +6,8 @@ import ( "syscall" ) -func fromStatT(s *syscall.Stat_t) (*Stat_t, error) { - return &Stat_t{size: s.Size, +func fromStatT(s *syscall.Stat_t) (*Stat, error) { + return &Stat{size: s.Size, mode: uint32(s.Mode), uid: s.Uid, gid: s.Gid, diff --git a/Godeps/_workspace/src/github.com/docker/docker/pkg/system/stat_windows.go b/Godeps/_workspace/src/github.com/docker/docker/pkg/system/stat_windows.go index 42d29d6cca0..584e8940ccf 100644 --- a/Godeps/_workspace/src/github.com/docker/docker/pkg/system/stat_windows.go +++ b/Godeps/_workspace/src/github.com/docker/docker/pkg/system/stat_windows.go @@ -7,11 +7,6 @@ import ( "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") } - -func Stat(path string) (*Stat_t, error) { - // should not be called on cli code path - return nil, ErrNotSupportedPlatform -} diff --git a/Godeps/_workspace/src/github.com/docker/docker/pkg/term/MAINTAINERS b/Godeps/_workspace/src/github.com/docker/docker/pkg/term/MAINTAINERS new file mode 100644 index 00000000000..aee10c84210 --- /dev/null +++ b/Godeps/_workspace/src/github.com/docker/docker/pkg/term/MAINTAINERS @@ -0,0 +1 @@ +Solomon Hykes (@shykes) diff --git a/Godeps/_workspace/src/github.com/docker/docker/pkg/units/MAINTAINERS b/Godeps/_workspace/src/github.com/docker/docker/pkg/units/MAINTAINERS new file mode 100644 index 00000000000..96abeae5700 --- /dev/null +++ b/Godeps/_workspace/src/github.com/docker/docker/pkg/units/MAINTAINERS @@ -0,0 +1,2 @@ +Victor Vieux (@vieux) +Jessie Frazelle (@jfrazelle) diff --git a/pkg/kubelet/dockertools/docker.go b/pkg/kubelet/dockertools/docker.go index 41b9f3d104f..0ccd72e73df 100644 --- a/pkg/kubelet/dockertools/docker.go +++ b/pkg/kubelet/dockertools/docker.go @@ -35,7 +35,6 @@ import ( "github.com/GoogleCloudPlatform/kubernetes/pkg/kubelet/leaky" "github.com/GoogleCloudPlatform/kubernetes/pkg/types" "github.com/GoogleCloudPlatform/kubernetes/pkg/util" - "github.com/docker/docker/pkg/parsers" docker "github.com/fsouza/go-dockerclient" "github.com/golang/glog" ) @@ -326,7 +325,7 @@ func NewDockerContainerCommandRunner(client DockerInterface) ContainerCommandRun } 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 len(tag) == 0 { @@ -380,6 +379,16 @@ func (p dockerPuller) IsImagePresent(image string) (bool, error) { 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) { return p.puller.IsImagePresent(name) } @@ -762,6 +771,29 @@ func GetRunningContainers(client DockerInterface, ids []string) ([]*docker.Conta 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 func getDockerEndpoint(dockerEndpoint string) string { var endpoint string diff --git a/pkg/kubelet/dockertools/docker_test.go b/pkg/kubelet/dockertools/docker_test.go index 57fb574d462..afb881ae730 100644 --- a/pkg/kubelet/dockertools/docker_test.go +++ b/pkg/kubelet/dockertools/docker_test.go @@ -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) { fakeKeyring := &credentialprovider.FakeKeyring{} fakeClient := &FakeDockerClient{ @@ -194,7 +217,7 @@ func TestDockerKeyringLookupFails(t *testing.T) { if err == nil { 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 { t.Errorf("expected: %s, saw: %s", msg, err.Error()) }