filter password from logs
This commit is contained in:
parent
84eff2dc93
commit
abcc02dc64
@ -129,25 +129,25 @@ 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.Replace(
|
||||
strings.Join(args, " "),
|
||||
password,
|
||||
"<password>",
|
||||
-1))
|
||||
log.Printf("Starting ovftool with parameters: %s", p.filterLog(strings.Join(args, " ")))
|
||||
|
||||
var out bytes.Buffer
|
||||
cmd := exec.Command("ovftool", args...)
|
||||
cmd.Stdout = &out
|
||||
if err := cmd.Run(); err != nil {
|
||||
return nil, false, fmt.Errorf("Failed: %s\n%s\n", err, out.String())
|
||||
return nil, false, fmt.Errorf("Failed: %s\n%s\n", err, p.filterLog(out.String()))
|
||||
}
|
||||
|
||||
ui.Message(out.String())
|
||||
ui.Message(p.filterLog(out.String()))
|
||||
|
||||
return artifact, false, nil
|
||||
}
|
||||
|
||||
func (p *PostProcessor) filterLog(s string) string {
|
||||
password := url.QueryEscape(p.config.Password)
|
||||
return strings.Replace(s, password, "<password>", -1)
|
||||
}
|
||||
|
||||
func (p *PostProcessor) BuildArgs(source, ovftool_uri string) ([]string, error) {
|
||||
args := []string{
|
||||
"--acceptAllEulas",
|
||||
|
Loading…
x
Reference in New Issue
Block a user