Revert "Updated vendor pacakge for winrmcp"

This reverts commit e38c1122ab.
This commit is contained in:
Chris Bednarski 2016-05-06 23:02:09 -07:00
parent e38c1122ab
commit d458f81dd8
3 changed files with 6 additions and 23 deletions

2
Godeps/Godeps.json generated
View File

@ -1,7 +1,7 @@
{ {
"ImportPath": "github.com/mitchellh/packer", "ImportPath": "github.com/mitchellh/packer",
"GoVersion": "go1.6", "GoVersion": "go1.6",
"GodepVersion": "v63", "GodepVersion": "v62",
"Deps": [ "Deps": [
{ {
"ImportPath": "github.com/ActiveState/tail", "ImportPath": "github.com/ActiveState/tail",

View File

@ -10,21 +10,18 @@ import (
"sync" "sync"
"github.com/masterzen/winrm/winrm" "github.com/masterzen/winrm/winrm"
"github.com/nu7hatch/gouuid" "github.com/mitchellh/packer/common/uuid"
) )
func doCopy(client *winrm.Client, config *Config, in io.Reader, toPath string) error { func doCopy(client *winrm.Client, config *Config, in io.Reader, toPath string) error {
tempFile, err := tempFileName() tempFile := fmt.Sprintf("winrmcp-%s.tmp", uuid.TimeOrderedUUID())
if err != nil {
return errors.New(fmt.Sprintf("Error generating unique filename: %v", err))
}
tempPath := "$env:TEMP\\" + tempFile tempPath := "$env:TEMP\\" + tempFile
if os.Getenv("WINRMCP_DEBUG") != "" { if os.Getenv("WINRMCP_DEBUG") != "" {
log.Printf("Copying file to %s\n", tempPath) log.Printf("Copying file to %s\n", tempPath)
} }
err = uploadContent(client, config.MaxOperationsPerShell, "%TEMP%\\"+tempFile, in) err := uploadContent(client, config.MaxOperationsPerShell, "%TEMP%\\"+tempFile, in)
if err != nil { if err != nil {
return errors.New(fmt.Sprintf("Error uploading file to %s: %v", tempPath, err)) return errors.New(fmt.Sprintf("Error uploading file to %s: %v", tempPath, err))
} }
@ -116,7 +113,7 @@ func restoreContent(client *winrm.Client, fromPath, toPath string) error {
defer shell.Close() defer shell.Close()
script := fmt.Sprintf(` script := fmt.Sprintf(`
$tmp_file_path = [System.IO.Path]::GetFullPath("%s") $tmp_file_path = [System.IO.Path]::GetFullPath("%s")
$dest_file_path = [System.IO.Path]::GetFullPath("%s".Trim("'")) $dest_file_path = [System.IO.Path]::GetFullPath("%s")
if (Test-Path $dest_file_path) { if (Test-Path $dest_file_path) {
rm $dest_file_path rm $dest_file_path
} }
@ -201,12 +198,3 @@ func appendContent(shell *winrm.Shell, filePath, content string) error {
return nil return nil
} }
func tempFileName() (string, error) {
uniquePart, err := uuid.NewV4()
if err != nil {
return "", err
}
return fmt.Sprintf("winrmcp-%s.tmp", uniquePart), nil
}

View File

@ -42,12 +42,7 @@ func New(addr string, config *Config) (*Winrmcp, error) {
config = &Config{} config = &Config{}
} }
params := winrm.NewParameters( params := winrm.DefaultParameters()
winrm.DefaultParameters.Timeout,
winrm.DefaultParameters.Locale,
winrm.DefaultParameters.EnvelopeSize,
)
if config.TransportDecorator != nil { if config.TransportDecorator != nil {
params.TransportDecorator = config.TransportDecorator params.TransportDecorator = config.TransportDecorator
} }