From 192d550cd7be67b15d10fd2673c36b5e2549544e Mon Sep 17 00:00:00 2001 From: Matthew Hooker Date: Fri, 10 Feb 2017 01:01:03 -0800 Subject: [PATCH] filter password in ovtool --- post-processor/vsphere/post-processor.go | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/post-processor/vsphere/post-processor.go b/post-processor/vsphere/post-processor.go index 3c76024c0..55ceded4a 100644 --- a/post-processor/vsphere/post-processor.go +++ b/post-processor/vsphere/post-processor.go @@ -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, + "", + -1)) cmd := exec.Command("ovftool", args...) cmd.Stdout = os.Stdout cmd.Stderr = os.Stderr