Merge pull request #4438 from mitchellh/winrmupload

communicator/winrm: make directory upload behave more like scp
This commit is contained in:
Matthew Hooker 2017-03-10 16:30:14 -08:00 committed by GitHub
commit cc95b90abb
1 changed files with 5 additions and 0 deletions

View File

@ -5,6 +5,8 @@ import (
"io"
"log"
"os"
"path/filepath"
"strings"
"sync"
"github.com/masterzen/winrm"
@ -129,6 +131,9 @@ func (c *Communicator) Upload(path string, input io.Reader, _ *os.FileInfo) erro
// UploadDir implementation of communicator.Communicator interface
func (c *Communicator) UploadDir(dst string, src string, exclude []string) error {
if !strings.HasSuffix(src, "/") {
dst = fmt.Sprintf("%s\\%s", dst, filepath.Base(src))
}
log.Printf("Uploading dir '%s' to '%s'", src, dst)
wcp, err := c.newCopyClient()
if err != nil {