builder/vmware: allow extra options for ovftool

This commit is contained in:
Matthew Hooker 2017-02-10 00:22:02 -08:00
parent 0d3dd48ab4
commit 0ed84f843e
No known key found for this signature in database
GPG Key ID: 7B5F933D9CE8C6A1
3 changed files with 15 additions and 7 deletions

View File

@ -38,19 +38,20 @@ type Config struct {
vmwcommon.VMXConfig `mapstructure:",squash"`
AdditionalDiskSize []uint `mapstructure:"disk_additional_size"`
BootCommand []string `mapstructure:"boot_command"`
DiskName string `mapstructure:"vmdk_name"`
DiskSize uint `mapstructure:"disk_size"`
DiskTypeId string `mapstructure:"disk_type_id"`
Format string `mapstructure:"format"`
GuestOSType string `mapstructure:"guest_os_type"`
Version string `mapstructure:"version"`
VMName string `mapstructure:"vm_name"`
BootCommand []string `mapstructure:"boot_command"`
KeepRegistered bool `mapstructure:"keep_registered"`
OVFToolOptions []string `mapstructure:"ovftool_options"`
SkipCompaction bool `mapstructure:"skip_compaction"`
SkipExport bool `mapstructure:"skip_export"`
VMXTemplatePath string `mapstructure:"vmx_template_path"`
VMName string `mapstructure:"vm_name"`
VMXDiskTemplatePath string `mapstructure:"vmx_disk_template_path"`
VMXTemplatePath string `mapstructure:"vmx_template_path"`
Version string `mapstructure:"version"`
RemoteType string `mapstructure:"remote_type"`
RemoteDatastore string `mapstructure:"remote_datastore"`

View File

@ -3,14 +3,15 @@ package iso
import (
"bytes"
"fmt"
"github.com/mitchellh/multistep"
"github.com/mitchellh/packer/packer"
"net/url"
"os"
"os/exec"
"path/filepath"
"runtime"
"strings"
"github.com/mitchellh/multistep"
"github.com/mitchellh/packer/packer"
)
type StepExport struct {
@ -23,13 +24,14 @@ func (s *StepExport) generateArgs(c *Config, outputPath string, hidePassword boo
if hidePassword {
password = "****"
}
return []string{
args := []string{
"--noSSLVerify=true",
"--skipManifestCheck",
"-tt=" + s.Format,
"vi://" + c.RemoteUser + ":" + password + "@" + c.RemoteHost + "/" + c.VMName,
outputPath,
}
return append(c.OVFToolOptions, args...)
}
func (s *StepExport) Run(state multistep.StateBag) multistep.StepAction {

View File

@ -240,6 +240,11 @@ builder.
deploy the resulting artifact (VMX or OVA or whatever you used as `format`).
Defaults to `false`.
- `ovftool_options` (array of strings) - Extra options to pass to ovftool
during export. Each item in the array is a new argument. The options
`--noSSLVerify`, `--skipManifestCheck`, and `--targetType` are reserved,
and should not be passed to this argument.
- `tools_upload_flavor` (string) - The flavor of the VMware Tools ISO to
upload into the VM. Valid values are "darwin", "linux", and "windows". By
default, this is empty, which means VMware tools won't be uploaded.