Change to use query syntax instead of manually throwing queries in.
Co-authored-by: Adrien Delorme <azr@users.noreply.github.com>
This commit is contained in:
parent
393b2d16c4
commit
1b6b44589d
|
@ -133,11 +133,13 @@ func (p *PostProcessor) generateURI() (*url.URL, error) {
|
||||||
u.User = url.UserPassword(p.config.Username, p.config.Password)
|
u.User = url.UserPassword(p.config.Username, p.config.Password)
|
||||||
|
|
||||||
if p.config.ESXiHost != "" {
|
if p.config.ESXiHost != "" {
|
||||||
|
q := u.Query()
|
||||||
if ipv4Regex.MatchString(p.config.ESXiHost) {
|
if ipv4Regex.MatchString(p.config.ESXiHost) {
|
||||||
u.RawQuery = "ip=" + url.QueryEscape(p.config.ESXiHost)
|
q.Add("ip", p.config.ESXiHost)
|
||||||
} else if hostnameRegex.MatchString(p.config.ESXiHost) {
|
} else if hostnameRegex.MatchString(p.config.ESXiHost) {
|
||||||
u.RawQuery = "dns=" + url.QueryEscape(p.config.ESXiHost)
|
q.Add("dns", p.config.ESXiHost)
|
||||||
}
|
}
|
||||||
|
u.RawQuery = q.Encode()
|
||||||
}
|
}
|
||||||
return u, nil
|
return u, nil
|
||||||
}
|
}
|
||||||
|
@ -191,7 +193,7 @@ func (p *PostProcessor) PostProcess(ctx context.Context, ui packer.Ui, artifact
|
||||||
|
|
||||||
func filterLog(s string, u *url.URL) string {
|
func filterLog(s string, u *url.URL) string {
|
||||||
password, passwordSet := u.User.Password()
|
password, passwordSet := u.User.Password()
|
||||||
if passwordSet {
|
if passwordSet && password != "" {
|
||||||
return strings.Replace(s, password, "<password>", -1)
|
return strings.Replace(s, password, "<password>", -1)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue