Commit fce2fc52 authored by Michael Kuzmin's avatar Michael Kuzmin

Optional parameters in vSphere post-processor.

datastore, vm_folder, and vm_network options can be omitted.
parent bb8d0a5e
......@@ -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(
......
......@@ -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.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment