Merge pull request #1091 from mkuzmin/vsphere-parameters

post-processors/vsphere: Optional parameters in vSphere post-processor
This commit is contained in:
Mitchell Hashimoto 2014-04-30 15:50:51 -07:00
commit 12d16cace1
2 changed files with 13 additions and 10 deletions

View File

@ -64,14 +64,11 @@ func (p *PostProcessor) Configure(raws ...interface{}) error {
templates := map[string]*string{
"cluster": &p.config.Cluster,
"datacenter": &p.config.Datacenter,
"datastore": &p.config.Datastore,
"diskmode": &p.config.DiskMode,
"host": &p.config.Host,
"vm_network": &p.config.VMNetwork,
"password": &p.config.Password,
"resource_pool": &p.config.ResourcePool,
"username": &p.config.Username,
"vm_folder": &p.config.VMFolder,
"vm_name": &p.config.VMName,
}
@ -80,7 +77,13 @@ func (p *PostProcessor) Configure(raws ...interface{}) error {
errs = packer.MultiErrorAppend(
errs, fmt.Errorf("%s must be set", key))
}
}
templates ["datastore"] = &p.config.Datastore
templates ["vm_network"] = &p.config.VMNetwork
templates ["vm_folder"] = &p.config.VMFolder
for key, ptr := range templates {
*ptr, err = p.config.tpl.Process(*ptr, nil)
if err != nil {
errs = packer.MultiErrorAppend(

View File

@ -23,8 +23,6 @@ Required:
* `datacenter` (string) - The name of the datacenter within vSphere to
add the VM to.
* `datastore` (string) - The name of the datastore to store this VM.
* `host` (string) - The vSphere host that will be contacted to perform
the VM upload.
@ -36,17 +34,19 @@ Required:
* `username` (string) - The username to use to authenticate to the vSphere
endpoint.
* `vm_folder` (string) - The folder within the datastore to store the VM.
* `vm_name` (string) - The name of the VM once it is uploaded.
* `vm_network` (string) - The name of the VM network this VM will be
added to.
Optional:
* `datastore` (string) - The name of the datastore to store this VM.
* `disk_mode` (string) - Target disk format. See `ovftool` manual for
available options. By default, "thick" will be used.
* `insecure` (bool) - Whether or not the connection to vSphere can be done
over an insecure connection. By default this is false.
* `vm_folder` (string) - The folder within the datastore to store the VM.
* `vm_network` (string) - The name of the VM network this VM will be
added to.