Add VirtualBox headless mode.
This commit is contained in:
parent
4aa55c40de
commit
f27ea933a4
|
@ -30,6 +30,7 @@ type config struct {
|
||||||
DiskSize uint `mapstructure:"disk_size"`
|
DiskSize uint `mapstructure:"disk_size"`
|
||||||
GuestAdditionsPath string `mapstructure:"guest_additions_path"`
|
GuestAdditionsPath string `mapstructure:"guest_additions_path"`
|
||||||
GuestOSType string `mapstructure:"guest_os_type"`
|
GuestOSType string `mapstructure:"guest_os_type"`
|
||||||
|
Headless bool `mapstructure:"headless"`
|
||||||
HTTPDir string `mapstructure:"http_directory"`
|
HTTPDir string `mapstructure:"http_directory"`
|
||||||
HTTPPortMin uint `mapstructure:"http_port_min"`
|
HTTPPortMin uint `mapstructure:"http_port_min"`
|
||||||
HTTPPortMax uint `mapstructure:"http_port_max"`
|
HTTPPortMax uint `mapstructure:"http_port_max"`
|
||||||
|
|
|
@ -23,7 +23,11 @@ func (s *stepRun) Run(state map[string]interface{}) multistep.StepAction {
|
||||||
vmName := state["vmName"].(string)
|
vmName := state["vmName"].(string)
|
||||||
|
|
||||||
ui.Say("Starting the virtual machine...")
|
ui.Say("Starting the virtual machine...")
|
||||||
command := []string{"startvm", vmName, "--type", "gui"}
|
guiArgument := "gui"
|
||||||
|
if config.Headless == true {
|
||||||
|
guiArgument = "headless"
|
||||||
|
}
|
||||||
|
command := []string{"startvm", vmName, "--type", guiArgument}
|
||||||
if err := driver.VBoxManage(command...); err != nil {
|
if err := driver.VBoxManage(command...); err != nil {
|
||||||
err := fmt.Errorf("Error starting VM: %s", err)
|
err := fmt.Errorf("Error starting VM: %s", err)
|
||||||
state["error"] = err
|
state["error"] = err
|
||||||
|
|
Loading…
Reference in New Issue