Post-Processor/Vsphere: Added custom options
This commit is contained in:
parent
34f163ce87
commit
0bc042a15c
|
@ -28,6 +28,7 @@ type Config struct {
|
|||
DiskMode string `mapstructure:"disk_mode"`
|
||||
Host string `mapstructure:"host"`
|
||||
Insecure bool `mapstructure:"insecure"`
|
||||
Options []string `mapstructure:"options"`
|
||||
Overwrite bool `mapstructure:"overwrite"`
|
||||
Password string `mapstructure:"password"`
|
||||
ResourcePool string `mapstructure:"resource_pool"`
|
||||
|
@ -143,12 +144,16 @@ func (p *PostProcessor) PostProcess(ui packer.Ui, artifact packer.Artifact) (pac
|
|||
options = append(options, "--overwrite")
|
||||
}
|
||||
|
||||
if len(p.config.Options) > 0 {
|
||||
options = append(options, p.config.Options...)
|
||||
}
|
||||
|
||||
command := append(options, args...)
|
||||
|
||||
ui.Message(fmt.Sprintf("Uploading %s to vSphere", vmx))
|
||||
var out bytes.Buffer
|
||||
log.Printf("Starting ovftool with parameters: %s", strings.Join(command, " "))
|
||||
cmd := exec.Command("ovftool", args...)
|
||||
cmd := exec.Command("ovftool", command...)
|
||||
cmd.Stdout = &out
|
||||
if err := cmd.Run(); err != nil {
|
||||
return nil, false, fmt.Errorf("Failed: %s\nStdout: %s", err, out.String())
|
||||
|
|
|
@ -58,3 +58,7 @@ 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
|
||||
--help` to list all the options
|
||||
|
||||
|
|
Loading…
Reference in New Issue