relay ovftool output.

This commit is contained in:
Matthew Hooker 2017-10-23 15:38:37 -07:00
parent 449da83896
commit 0cf0a4336d
No known key found for this signature in database
GPG Key ID: 7B5F933D9CE8C6A1
1 changed files with 7 additions and 4 deletions

View File

@ -1,10 +1,10 @@
package vsphere
import (
"bytes"
"fmt"
"log"
"net/url"
"os"
"os/exec"
"strings"
@ -135,13 +135,16 @@ func (p *PostProcessor) PostProcess(ui packer.Ui, artifact packer.Artifact) (pac
password,
"<password>",
-1))
var out bytes.Buffer
cmd := exec.Command("ovftool", args...)
cmd.Stdout = os.Stdout
cmd.Stderr = os.Stderr
cmd.Stdout = &out
if err := cmd.Run(); err != nil {
return nil, false, fmt.Errorf("Failed: %s\n", err)
return nil, false, fmt.Errorf("Failed: %s\n%s\n", err, out.String())
}
ui.Message(out.String())
return artifact, false, nil
}