2019-05-31 08:27:41 -04:00
|
|
|
//go:generate struct-markdown
|
|
|
|
|
2014-04-06 13:21:22 -04:00
|
|
|
package common
|
|
|
|
|
|
|
|
import (
|
2020-12-17 16:29:25 -05:00
|
|
|
"github.com/hashicorp/packer-plugin-sdk/template/interpolate"
|
2014-04-06 13:21:22 -04:00
|
|
|
)
|
|
|
|
|
2016-12-16 14:51:55 -05:00
|
|
|
// PrlctlConfig contains the configuration for running "prlctl" commands
|
|
|
|
// before the VM start.
|
2014-04-06 13:21:22 -04:00
|
|
|
type PrlctlConfig struct {
|
2019-05-28 11:50:58 -04:00
|
|
|
// Custom prlctl commands to execute
|
2019-06-06 10:29:25 -04:00
|
|
|
// in order to further customize the virtual machine being created. The value
|
|
|
|
// of this is an array of commands to execute. The commands are executed in the
|
|
|
|
// order defined in the template. For each command, the command is defined
|
|
|
|
// itself as an array of strings, where each string represents a single
|
|
|
|
// argument on the command-line to prlctl (but excluding prlctl itself).
|
|
|
|
// Each arg is treated as a configuration
|
|
|
|
// template, where the Name
|
|
|
|
// variable is replaced with the VM name. More details on how to use prlctl
|
|
|
|
// are below.
|
2019-05-28 11:50:58 -04:00
|
|
|
Prlctl [][]string `mapstructure:"prlctl" required:"false"`
|
2014-04-06 13:21:22 -04:00
|
|
|
}
|
|
|
|
|
2016-12-16 14:51:55 -05:00
|
|
|
// Prepare sets the default value of "Prlctl" property.
|
2015-05-27 16:49:31 -04:00
|
|
|
func (c *PrlctlConfig) Prepare(ctx *interpolate.Context) []error {
|
2014-04-06 13:21:22 -04:00
|
|
|
if c.Prlctl == nil {
|
|
|
|
c.Prlctl = make([][]string, 0)
|
|
|
|
}
|
|
|
|
|
2015-05-27 16:49:31 -04:00
|
|
|
return nil
|
2014-04-06 13:21:22 -04:00
|
|
|
}
|