Use Trilean for boolean value, and allow for missing values for defaults
This commit is contained in:
parent
977022fb35
commit
fdda18e392
|
@ -54,7 +54,7 @@ func (*cloneVMCreator) Create(vmRef *proxmoxapi.VmRef, config proxmoxapi.ConfigQ
|
|||
comm := state.Get("comm").(*communicator.Config)
|
||||
|
||||
fullClone := 1
|
||||
if c.FullClone == false {
|
||||
if c.FullClone.False() {
|
||||
fullClone = 0
|
||||
}
|
||||
|
||||
|
|
|
@ -4,14 +4,15 @@ package proxmoxclone
|
|||
|
||||
import (
|
||||
proxmox "github.com/hashicorp/packer/builder/proxmox/common"
|
||||
"github.com/hashicorp/packer/helper/config"
|
||||
"github.com/hashicorp/packer/packer"
|
||||
)
|
||||
|
||||
type Config struct {
|
||||
proxmox.Config `mapstructure:",squash"`
|
||||
|
||||
CloneVM string `mapstructure:"clone_vm"`
|
||||
FullClone bool `mapstructure:"full_clone"`
|
||||
CloneVM string `mapstructure:"clone_vm"`
|
||||
FullClone config.Trilean `mapstructure:"full_clone" required:"false"`
|
||||
}
|
||||
|
||||
func (c *Config) Prepare(raws ...interface{}) ([]string, []string, error) {
|
||||
|
|
|
@ -100,7 +100,7 @@ type FlatConfig struct {
|
|||
AdditionalISOFiles []proxmox.FlatstorageConfig `mapstructure:"additional_iso_files" cty:"additional_iso_files" hcl:"additional_iso_files"`
|
||||
VMInterface *string `mapstructure:"vm_interface" cty:"vm_interface" hcl:"vm_interface"`
|
||||
CloneVM *string `mapstructure:"clone_vm" cty:"clone_vm" hcl:"clone_vm"`
|
||||
FullClone *bool `mapstructure:"full_clone" cty:"full_clone" hcl:"full_clone"`
|
||||
FullClone *bool `mapstructure:"full_clone" required:"false" cty:"full_clone" hcl:"full_clone"`
|
||||
}
|
||||
|
||||
// FlatMapstructure returns a new FlatConfig.
|
||||
|
|
Loading…
Reference in New Issue