mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-27 05:27:21 +00:00
bump(docker/docker/pkg/parsers):ed6685369740035b0af9675bf9add52d0af7657b
Add docker/docker/pkg/parsers and bump entire set of docker/docker/... dependencies.
This commit is contained in:
parent
879a39bcc4
commit
73229ed660
49
Godeps/Godeps.json
generated
49
Godeps/Godeps.json
generated
@ -88,58 +88,63 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"ImportPath": "github.com/docker/docker/pkg/archive",
|
"ImportPath": "github.com/docker/docker/pkg/archive",
|
||||||
"Comment": "v1.4.1-656-g2115131",
|
"Comment": "v1.4.1-1714-ged66853",
|
||||||
"Rev": "211513156dc1ace48e630b4bf4ea0fcfdc8d9abf"
|
"Rev": "ed6685369740035b0af9675bf9add52d0af7657b"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"ImportPath": "github.com/docker/docker/pkg/fileutils",
|
"ImportPath": "github.com/docker/docker/pkg/fileutils",
|
||||||
"Comment": "v1.4.1-656-g2115131",
|
"Comment": "v1.4.1-1714-ged66853",
|
||||||
"Rev": "211513156dc1ace48e630b4bf4ea0fcfdc8d9abf"
|
"Rev": "ed6685369740035b0af9675bf9add52d0af7657b"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"ImportPath": "github.com/docker/docker/pkg/ioutils",
|
"ImportPath": "github.com/docker/docker/pkg/ioutils",
|
||||||
"Comment": "v1.4.1-656-g2115131",
|
"Comment": "v1.4.1-1714-ged66853",
|
||||||
"Rev": "211513156dc1ace48e630b4bf4ea0fcfdc8d9abf"
|
"Rev": "ed6685369740035b0af9675bf9add52d0af7657b"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"ImportPath": "github.com/docker/docker/pkg/mount",
|
"ImportPath": "github.com/docker/docker/pkg/mount",
|
||||||
"Comment": "v1.4.1-656-g2115131",
|
"Comment": "v1.4.1-1714-ged66853",
|
||||||
"Rev": "211513156dc1ace48e630b4bf4ea0fcfdc8d9abf"
|
"Rev": "ed6685369740035b0af9675bf9add52d0af7657b"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"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-656-g2115131",
|
"Comment": "v1.4.1-1714-ged66853",
|
||||||
"Rev": "211513156dc1ace48e630b4bf4ea0fcfdc8d9abf"
|
"Rev": "ed6685369740035b0af9675bf9add52d0af7657b"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"ImportPath": "github.com/docker/docker/pkg/promise",
|
"ImportPath": "github.com/docker/docker/pkg/promise",
|
||||||
"Comment": "v1.4.1-656-g2115131",
|
"Comment": "v1.4.1-1714-ged66853",
|
||||||
"Rev": "211513156dc1ace48e630b4bf4ea0fcfdc8d9abf"
|
"Rev": "ed6685369740035b0af9675bf9add52d0af7657b"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"ImportPath": "github.com/docker/docker/pkg/symlink",
|
"ImportPath": "github.com/docker/docker/pkg/symlink",
|
||||||
"Comment": "v1.4.1-656-g2115131",
|
"Comment": "v1.4.1-1714-ged66853",
|
||||||
"Rev": "211513156dc1ace48e630b4bf4ea0fcfdc8d9abf"
|
"Rev": "ed6685369740035b0af9675bf9add52d0af7657b"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"ImportPath": "github.com/docker/docker/pkg/system",
|
"ImportPath": "github.com/docker/docker/pkg/system",
|
||||||
"Comment": "v1.4.1-656-g2115131",
|
"Comment": "v1.4.1-1714-ged66853",
|
||||||
"Rev": "211513156dc1ace48e630b4bf4ea0fcfdc8d9abf"
|
"Rev": "ed6685369740035b0af9675bf9add52d0af7657b"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"ImportPath": "github.com/docker/docker/pkg/term",
|
"ImportPath": "github.com/docker/docker/pkg/term",
|
||||||
"Comment": "v1.4.1-656-g2115131",
|
"Comment": "v1.4.1-1714-ged66853",
|
||||||
"Rev": "211513156dc1ace48e630b4bf4ea0fcfdc8d9abf"
|
"Rev": "ed6685369740035b0af9675bf9add52d0af7657b"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"ImportPath": "github.com/docker/docker/pkg/units",
|
"ImportPath": "github.com/docker/docker/pkg/units",
|
||||||
"Comment": "v1.4.1-656-g2115131",
|
"Comment": "v1.4.1-1714-ged66853",
|
||||||
"Rev": "211513156dc1ace48e630b4bf4ea0fcfdc8d9abf"
|
"Rev": "ed6685369740035b0af9675bf9add52d0af7657b"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"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-656-g2115131",
|
"Comment": "v1.4.1-1714-ged66853",
|
||||||
"Rev": "211513156dc1ace48e630b4bf4ea0fcfdc8d9abf"
|
"Rev": "ed6685369740035b0af9675bf9add52d0af7657b"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"ImportPath": "github.com/docker/libcontainer",
|
"ImportPath": "github.com/docker/libcontainer",
|
||||||
|
2
Godeps/_workspace/src/github.com/docker/docker/pkg/archive/MAINTAINERS
generated
vendored
2
Godeps/_workspace/src/github.com/docker/docker/pkg/archive/MAINTAINERS
generated
vendored
@ -1,2 +0,0 @@
|
|||||||
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,7 +101,6 @@ 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 {
|
||||||
@ -173,6 +172,21 @@ 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 {
|
||||||
@ -190,11 +204,12 @@ 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)))
|
||||||
|
|
||||||
if fi.IsDir() && !strings.HasSuffix(name, "/") {
|
name, err = canonicalTarName(name, fi.IsDir())
|
||||||
name = name + "/"
|
if err != nil {
|
||||||
|
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())
|
||||||
@ -459,7 +474,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", srcPath, err)
|
log.Debugf("Can't add file %s to tar: %s", filePath, err)
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
})
|
})
|
||||||
@ -526,7 +541,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))
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -682,6 +697,8 @@ 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,11 +4,26 @@ 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,9 +3,39 @@
|
|||||||
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,6 +6,7 @@ import (
|
|||||||
"io"
|
"io"
|
||||||
"os"
|
"os"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
|
"sort"
|
||||||
"strings"
|
"strings"
|
||||||
"syscall"
|
"syscall"
|
||||||
"time"
|
"time"
|
||||||
@ -43,6 +44,13 @@ 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
|
||||||
@ -135,7 +143,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
|
stat *system.Stat_t
|
||||||
children map[string]*FileInfo
|
children map[string]*FileInfo
|
||||||
capability []byte
|
capability []byte
|
||||||
added bool
|
added bool
|
||||||
@ -373,6 +381,8 @@ 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,13 +25,6 @@ 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 (
|
||||||
@ -220,7 +213,7 @@ func TestChangesDirsMutated(t *testing.T) {
|
|||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
sort.Sort(byPath{changes})
|
sort.Sort(changesByPath(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
1
Godeps/_workspace/src/github.com/docker/docker/pkg/mount/MAINTAINERS
generated
vendored
@ -1 +0,0 @@
|
|||||||
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 propogated in or out
|
// nothing is propagated 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
Normal file
137
Godeps/_workspace/src/github.com/docker/docker/pkg/parsers/parsers.go
generated
vendored
Normal file
@ -0,0 +1,137 @@
|
|||||||
|
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
3
Godeps/_workspace/src/github.com/docker/docker/pkg/symlink/MAINTAINERS
generated
vendored
@ -1,3 +0,0 @@
|
|||||||
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
2
Godeps/_workspace/src/github.com/docker/docker/pkg/system/MAINTAINERS
generated
vendored
@ -1,2 +0,0 @@
|
|||||||
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, error) {
|
func Lstat(path string) (*Stat_t, 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, error) {
|
func Lstat(path string) (*Stat_t, 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 struct {
|
type Stat_t struct {
|
||||||
mode uint32
|
mode uint32
|
||||||
uid uint32
|
uid uint32
|
||||||
gid uint32
|
gid uint32
|
||||||
@ -13,30 +13,30 @@ type Stat struct {
|
|||||||
mtim syscall.Timespec
|
mtim syscall.Timespec
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s Stat) Mode() uint32 {
|
func (s Stat_t) Mode() uint32 {
|
||||||
return s.mode
|
return s.mode
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s Stat) Uid() uint32 {
|
func (s Stat_t) Uid() uint32 {
|
||||||
return s.uid
|
return s.uid
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s Stat) Gid() uint32 {
|
func (s Stat_t) Gid() uint32 {
|
||||||
return s.gid
|
return s.gid
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s Stat) Rdev() uint64 {
|
func (s Stat_t) Rdev() uint64 {
|
||||||
return s.rdev
|
return s.rdev
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s Stat) Size() int64 {
|
func (s Stat_t) Size() int64 {
|
||||||
return s.size
|
return s.size
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s Stat) Mtim() syscall.Timespec {
|
func (s Stat_t) Mtim() syscall.Timespec {
|
||||||
return s.mtim
|
return s.mtim
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s Stat) GetLastModification() syscall.Timespec {
|
func (s Stat_t) 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,11 +4,20 @@ import (
|
|||||||
"syscall"
|
"syscall"
|
||||||
)
|
)
|
||||||
|
|
||||||
func fromStatT(s *syscall.Stat_t) (*Stat, error) {
|
func fromStatT(s *syscall.Stat_t) (*Stat_t, error) {
|
||||||
return &Stat{size: s.Size,
|
return &Stat_t{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, error) {
|
func fromStatT(s *syscall.Stat_t) (*Stat_t, error) {
|
||||||
return &Stat{size: s.Size,
|
return &Stat_t{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,6 +7,11 @@ import (
|
|||||||
"syscall"
|
"syscall"
|
||||||
)
|
)
|
||||||
|
|
||||||
func fromStatT(s *syscall.Win32FileAttributeData) (*Stat, error) {
|
func fromStatT(s *syscall.Win32FileAttributeData) (*Stat_t, 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
1
Godeps/_workspace/src/github.com/docker/docker/pkg/term/MAINTAINERS
generated
vendored
@ -1 +0,0 @@
|
|||||||
Solomon Hykes <solomon@docker.com> (@shykes)
|
|
2
Godeps/_workspace/src/github.com/docker/docker/pkg/units/MAINTAINERS
generated
vendored
2
Godeps/_workspace/src/github.com/docker/docker/pkg/units/MAINTAINERS
generated
vendored
@ -1,2 +0,0 @@
|
|||||||
Victor Vieux <vieux@docker.com> (@vieux)
|
|
||||||
Jessie Frazelle <jess@docker.com> (@jfrazelle)
|
|
Loading…
Reference in New Issue
Block a user