Merge pull request #1628 from israelshirk/hotfix/docker-communicator-symlink

Fixes Docker communicator mishandling of symlinks in UploadDir()
This commit is contained in:
Seth Vargo 2014-11-26 16:28:41 -05:00
commit 1954cc9758
1 changed files with 10 additions and 0 deletions

View File

@ -117,6 +117,16 @@ func (c *Communicator) UploadDir(dst string, src string, exclude []string) error
return os.MkdirAll(hostpath, info.Mode()) return os.MkdirAll(hostpath, info.Mode())
} }
if info.Mode() & os.ModeSymlink == os.ModeSymlink {
dest, err := os.Readlink(path)
if err != nil {
return err
}
return os.Symlink(dest, hostpath)
}
// It is a file, copy it over, including mode. // It is a file, copy it over, including mode.
src, err := os.Open(path) src, err := os.Open(path)
if err != nil { if err != nil {