Merge pull request #4443 from mitchellh/preservedockermode

communicator/docker: preserve file mode.
This commit is contained in:
Matthew Hooker 2017-01-26 11:22:00 -08:00 committed by GitHub
commit 485fa58b43
1 changed files with 5 additions and 1 deletions

View File

@ -70,11 +70,15 @@ func (c *Communicator) Upload(dst string, src io.Reader, fi *os.FileInfo) error
// Copy the contents to the temporary file
_, err = io.Copy(tempfile, src)
tempfile.Close()
if err != nil {
return err
}
if fi != nil {
tempfile.Chmod((*fi).Mode())
}
tempfile.Close()
// Copy the file into place by copying the temporary file we put
// into the shared folder into the proper location in the container
cmd := &packer.RemoteCmd{