2020-09-04 23:53:09 +02:00
|
|
|
//go:generate mapstructure-to-hcl2 -type Config
|
|
|
|
|
|
|
|
package proxmoxclone
|
|
|
|
|
|
|
|
import (
|
2020-09-14 12:49:38 -07:00
|
|
|
proxmox "github.com/hashicorp/packer/builder/proxmox/common"
|
2020-11-19 12:07:02 -08:00
|
|
|
packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer"
|
2020-11-18 10:34:59 -08:00
|
|
|
"github.com/hashicorp/packer/packer-plugin-sdk/template/config"
|
2020-09-04 23:53:09 +02:00
|
|
|
)
|
|
|
|
|
|
|
|
type Config struct {
|
|
|
|
proxmox.Config `mapstructure:",squash"`
|
|
|
|
|
2020-10-06 17:24:45 -07:00
|
|
|
CloneVM string `mapstructure:"clone_vm"`
|
|
|
|
FullClone config.Trilean `mapstructure:"full_clone" required:"false"`
|
2020-09-04 23:53:09 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
func (c *Config) Prepare(raws ...interface{}) ([]string, []string, error) {
|
2020-11-19 12:07:02 -08:00
|
|
|
var errs *packersdk.MultiError
|
2020-09-04 23:53:09 +02:00
|
|
|
_, warnings, merrs := c.Config.Prepare(c, raws...)
|
|
|
|
if merrs != nil {
|
2020-11-19 12:07:02 -08:00
|
|
|
errs = packersdk.MultiErrorAppend(errs, merrs)
|
2020-09-04 23:53:09 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
if errs != nil && len(errs.Errors) > 0 {
|
|
|
|
return nil, warnings, errs
|
|
|
|
}
|
|
|
|
return nil, warnings, nil
|
|
|
|
}
|