Merge pull request #1178 from mkuzmin/url-escape
vSphere upload hangs due to DOMAIN\account format of username
This commit is contained in:
commit
9f24766e51
|
@ -3,10 +3,12 @@ package vsphere
|
||||||
import (
|
import (
|
||||||
"bytes"
|
"bytes"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"log"
|
||||||
"github.com/mitchellh/packer/common"
|
"github.com/mitchellh/packer/common"
|
||||||
"github.com/mitchellh/packer/packer"
|
"github.com/mitchellh/packer/packer"
|
||||||
"os/exec"
|
"os/exec"
|
||||||
"strings"
|
"strings"
|
||||||
|
"net/url"
|
||||||
)
|
)
|
||||||
|
|
||||||
var builtins = map[string]string{
|
var builtins = map[string]string{
|
||||||
|
@ -127,7 +129,7 @@ func (p *PostProcessor) PostProcess(ui packer.Ui, artifact packer.Artifact) (pac
|
||||||
fmt.Sprintf("--vmFolder=%s", p.config.VMFolder),
|
fmt.Sprintf("--vmFolder=%s", p.config.VMFolder),
|
||||||
fmt.Sprintf("%s", vmx),
|
fmt.Sprintf("%s", vmx),
|
||||||
fmt.Sprintf("vi://%s:%s@%s/%s/host/%s/Resources/%s",
|
fmt.Sprintf("vi://%s:%s@%s/%s/host/%s/Resources/%s",
|
||||||
p.config.Username,
|
url.QueryEscape(p.config.Username),
|
||||||
p.config.Password,
|
p.config.Password,
|
||||||
p.config.Host,
|
p.config.Host,
|
||||||
p.config.Datacenter,
|
p.config.Datacenter,
|
||||||
|
@ -137,6 +139,7 @@ func (p *PostProcessor) PostProcess(ui packer.Ui, artifact packer.Artifact) (pac
|
||||||
|
|
||||||
ui.Message(fmt.Sprintf("Uploading %s to vSphere", vmx))
|
ui.Message(fmt.Sprintf("Uploading %s to vSphere", vmx))
|
||||||
var out bytes.Buffer
|
var out bytes.Buffer
|
||||||
|
log.Printf("Starting ovftool with parameters: %s", strings.Join(args, " "))
|
||||||
cmd := exec.Command("ovftool", args...)
|
cmd := exec.Command("ovftool", args...)
|
||||||
cmd.Stdout = &out
|
cmd.Stdout = &out
|
||||||
if err := cmd.Run(); err != nil {
|
if err := cmd.Run(); err != nil {
|
||||||
|
|
Loading…
Reference in New Issue