From 63d21ec9f3b00441a5f48416a9891e92d81e1f91 Mon Sep 17 00:00:00 2001 From: Eloy Coto Date: Thu, 29 Oct 2015 09:42:26 +0000 Subject: [PATCH] Vsphere post-processor: Fix merge problems --- post-processor/vsphere/post-processor.go | 19 ++++++------------- .../post-processors/vsphere.html.markdown | 3 +-- 2 files changed, 7 insertions(+), 15 deletions(-) diff --git a/post-processor/vsphere/post-processor.go b/post-processor/vsphere/post-processor.go index 182be5c0e..cde3d5480 100644 --- a/post-processor/vsphere/post-processor.go +++ b/post-processor/vsphere/post-processor.go @@ -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()) diff --git a/website/source/docs/post-processors/vsphere.html.markdown b/website/source/docs/post-processors/vsphere.html.markdown index 7cb790418..90bf6f40b 100644 --- a/website/source/docs/post-processors/vsphere.html.markdown +++ b/website/source/docs/post-processors/vsphere.html.markdown @@ -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 -