Merge pull request #4438 from mitchellh/winrmupload
communicator/winrm: make directory upload behave more like scp
This commit is contained in:
commit
cc95b90abb
|
@ -5,6 +5,8 @@ import (
|
||||||
"io"
|
"io"
|
||||||
"log"
|
"log"
|
||||||
"os"
|
"os"
|
||||||
|
"path/filepath"
|
||||||
|
"strings"
|
||||||
"sync"
|
"sync"
|
||||||
|
|
||||||
"github.com/masterzen/winrm"
|
"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
|
// UploadDir implementation of communicator.Communicator interface
|
||||||
func (c *Communicator) UploadDir(dst string, src string, exclude []string) error {
|
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)
|
log.Printf("Uploading dir '%s' to '%s'", src, dst)
|
||||||
wcp, err := c.newCopyClient()
|
wcp, err := c.newCopyClient()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
Loading…
Reference in New Issue