Vsphere post-processor: Fix merge problems

This commit is contained in:
Eloy Coto 2015-10-29 09:42:26 +00:00
parent 0bc042a15c
commit 63d21ec9f3
2 changed files with 7 additions and 15 deletions

View File

@ -121,7 +121,7 @@ func (p *PostProcessor) PostProcess(ui packer.Ui, artifact packer.Artifact) (pac
ovftool_uri += "/Resources/" + p.config.ResourcePool
}
options := []string{
args := []string{
fmt.Sprintf("--noSSLVerify=%t", p.config.Insecure),
"--acceptAllEulas",
fmt.Sprintf("--name=%s", p.config.VMName),
@ -135,25 +135,18 @@ func (p *PostProcessor) PostProcess(ui packer.Ui, artifact packer.Artifact) (pac
ui.Message(fmt.Sprintf("Uploading %s to vSphere", source))
args := []string{
fmt.Sprintf("%s", vmx),
fmt.Sprintf("%s", ovftool_uri),
}
if p.config.Overwrite == true {
options = append(options, "--overwrite")
args = append(args, "--overwrite")
}
if len(p.config.Options) > 0 {
options = append(options, p.config.Options...)
args = append(args, p.config.Options...)
}
command := append(options, args...)
ui.Message(fmt.Sprintf("Uploading %s to vSphere", vmx))
ui.Message(fmt.Sprintf("Uploading %s to vSphere", source))
var out bytes.Buffer
log.Printf("Starting ovftool with parameters: %s", strings.Join(command, " "))
cmd := exec.Command("ovftool", command...)
log.Printf("Starting ovftool with parameters: %s", strings.Join(args, " "))
cmd := exec.Command("ovftool", args...)
cmd.Stdout = &out
if err := cmd.Run(); err != nil {
return nil, false, fmt.Errorf("Failed: %s\nStdout: %s", err, out.String())

View File

@ -59,6 +59,5 @@ Optional:
- `overwrite` (boolean) - If it's true force the system to overwrite the
existing files instead create new ones. Default is false
* `options` (array of strings) - Custom options to add in ovftool. See `ovftool
- `options` (array of strings) - Custom options to add in ovftool. See `ovftool
--help` to list all the options