From d4080244b0f69658f5d6ba101bb774c403c6d153 Mon Sep 17 00:00:00 2001 From: Israel Shirk Date: Mon, 27 Oct 2014 20:59:21 -0600 Subject: [PATCH] Resolves issue where docker communicator mishandled symlinks by treating them as files --- builder/docker/communicator.go | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/builder/docker/communicator.go b/builder/docker/communicator.go index d5f0eb713..36ba291d3 100644 --- a/builder/docker/communicator.go +++ b/builder/docker/communicator.go @@ -117,6 +117,16 @@ func (c *Communicator) UploadDir(dst string, src string, exclude []string) error 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. src, err := os.Open(path) if err != nil {