Skip to content

Commit

Permalink
Merge pull request #4539 from mitchellh/ovftoolhidepassword
Browse files Browse the repository at this point in the history
filter password in ovtool
  • Loading branch information
mwhooker committed Feb 27, 2017
2 parents 6628d4e + 192d550 commit 99091a1
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions post-processor/vsphere/post-processor.go
Expand Up @@ -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)
Expand All @@ -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
Expand Down

0 comments on commit 99091a1

Please sign in to comment.