mirror of https://github.com/hashicorp/packer
parent
01eff9472a
commit
74f0d56cfc
@ -1,22 +0,0 @@
|
||||
//go:generate struct-markdown
|
||||
|
||||
package common
|
||||
|
||||
import (
|
||||
"github.com/hashicorp/packer/template/interpolate"
|
||||
)
|
||||
|
||||
type VBoxManagePostConfig struct {
|
||||
// Identical to vboxmanage,
|
||||
// except that it is run after the virtual machine is shutdown, and before the
|
||||
// virtual machine is exported.
|
||||
VBoxManagePost [][]string `mapstructure:"vboxmanage_post" required:"false"`
|
||||
}
|
||||
|
||||
func (c *VBoxManagePostConfig) Prepare(ctx *interpolate.Context) []error {
|
||||
if c.VBoxManagePost == nil {
|
||||
c.VBoxManagePost = make([][]string, 0)
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
@ -1,39 +0,0 @@
|
||||
package common
|
||||
|
||||
import (
|
||||
"reflect"
|
||||
"testing"
|
||||
|
||||
"github.com/hashicorp/packer/template/interpolate"
|
||||
)
|
||||
|
||||
func TestVBoxManagePostConfigPrepare_VBoxManage(t *testing.T) {
|
||||
// Test with empty
|
||||
c := new(VBoxManagePostConfig)
|
||||
errs := c.Prepare(interpolate.NewContext())
|
||||
if len(errs) > 0 {
|
||||
t.Fatalf("err: %#v", errs)
|
||||
}
|
||||
|
||||
if !reflect.DeepEqual(c.VBoxManagePost, [][]string{}) {
|
||||
t.Fatalf("bad: %#v", c.VBoxManagePost)
|
||||
}
|
||||
|
||||
// Test with a good one
|
||||
c = new(VBoxManagePostConfig)
|
||||
c.VBoxManagePost = [][]string{
|
||||
{"foo", "bar", "baz"},
|
||||
}
|
||||
errs = c.Prepare(interpolate.NewContext())
|
||||
if len(errs) > 0 {
|
||||
t.Fatalf("err: %#v", errs)
|
||||
}
|
||||
|
||||
expected := [][]string{
|
||||
{"foo", "bar", "baz"},
|
||||
}
|
||||
|
||||
if !reflect.DeepEqual(c.VBoxManagePost, expected) {
|
||||
t.Fatalf("bad: %#v", c.VBoxManagePost)
|
||||
}
|
||||
}
|
||||
@ -1,13 +1,17 @@
|
||||
<!-- Code generated from the comments of the VBoxManageConfig struct in builder/virtualbox/common/vboxmanage_config.go; DO NOT EDIT MANUALLY -->
|
||||
|
||||
- `vboxmanage` ([][]string) - Custom VBoxManage commands to
|
||||
execute 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 VBoxManage (but excluding
|
||||
VBoxManage 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
|
||||
VBoxManage are below.
|
||||
- `vboxmanage` ([][]string) - Custom `VBoxManage` commands to execute 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 `VBoxManage` (but excluding `VBoxManage` itself). Each
|
||||
arg is treated as a [configuration
|
||||
template](/docs/templates/engine.html), where the `Name` variable is
|
||||
replaced with the VM name. More details on how to use `VBoxManage` are
|
||||
below.
|
||||
|
||||
- `vboxmanage_post` ([][]string) - Identical to vboxmanage,
|
||||
except that it is run after the virtual machine is shutdown, and before the
|
||||
virtual machine is exported.
|
||||
|
||||
Loading…
Reference in new issue