filter password in ovtool

This commit is contained in:
Matthew Hooker 2017-02-10 01:01:03 -08:00
parent 3ee85b00d4
commit 192d550cd7
No known key found for this signature in database
GPG Key ID: 7B5F933D9CE8C6A1
1 changed files with 8 additions and 2 deletions

View File

@ -110,9 +110,10 @@ func (p *PostProcessor) PostProcess(ui packer.Ui, artifact packer.Artifact) (pac
return nil, false, fmt.Errorf("VMX, OVF or OVA file not found")
}
password := url.QueryEscape(p.config.Password)
ovftool_uri := fmt.Sprintf("vi://%s:%s@%s/%s/host/%s",
url.QueryEscape(p.config.Username),
url.QueryEscape(p.config.Password),
password,
p.config.Host,
p.config.Datacenter,
p.config.Cluster)
@ -128,7 +129,12 @@ func (p *PostProcessor) PostProcess(ui packer.Ui, artifact packer.Artifact) (pac
ui.Message(fmt.Sprintf("Uploading %s to vSphere", source))
log.Printf("Starting ovftool with parameters: %s", strings.Join(args, " "))
log.Printf("Starting ovftool with parameters: %s",
strings.Replace(
strings.Join(args, " "),
password,
"<password>",
-1))
cmd := exec.Command("ovftool", args...)
cmd.Stdout = os.Stdout
cmd.Stderr = os.Stderr