From 514b5f52f1e2768c10c26aaa90b732d94659fddc Mon Sep 17 00:00:00 2001 From: Ryan Breed Date: Wed, 12 Nov 2014 23:03:14 -0600 Subject: [PATCH] consistent escaping for ovftool uri creds I got thrown for a loop since the username is uri-escaped but the password was not. I got thrown for another couple of loops due to the multiple levels of interpretation involved: 1) JSON syntax requires backslashes to be slash-escaped. Some vCenter deployments use windows domain-style usernames DOMAIN\user 2) the OVFTOOL docs specify that "all special characters" be uri-encoded when part of the user name or password 3) different shell interpretations on windows/linux I'd say escape both or neither. --- post-processor/vsphere/post-processor.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/post-processor/vsphere/post-processor.go b/post-processor/vsphere/post-processor.go index 81dc27f87..38bff43aa 100644 --- a/post-processor/vsphere/post-processor.go +++ b/post-processor/vsphere/post-processor.go @@ -130,7 +130,7 @@ func (p *PostProcessor) PostProcess(ui packer.Ui, artifact packer.Artifact) (pac fmt.Sprintf("%s", vmx), fmt.Sprintf("vi://%s:%s@%s/%s/host/%s/Resources/%s/", url.QueryEscape(p.config.Username), - p.config.Password, + url.QueryEscape(p.config.Password), p.config.Host, p.config.Datacenter, p.config.Cluster,