Add VirtualBox headless mode.

This commit is contained in:
Steven Merrill 2013-07-02 00:13:24 -04:00
parent 4aa55c40de
commit f27ea933a4
2 changed files with 6 additions and 1 deletions

View File

@ -30,6 +30,7 @@ type config struct {
DiskSize uint `mapstructure:"disk_size"`
GuestAdditionsPath string `mapstructure:"guest_additions_path"`
GuestOSType string `mapstructure:"guest_os_type"`
Headless bool `mapstructure:"headless"`
HTTPDir string `mapstructure:"http_directory"`
HTTPPortMin uint `mapstructure:"http_port_min"`
HTTPPortMax uint `mapstructure:"http_port_max"`

View File

@ -23,7 +23,11 @@ func (s *stepRun) Run(state map[string]interface{}) multistep.StepAction {
vmName := state["vmName"].(string)
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 {
err := fmt.Errorf("Error starting VM: %s", err)
state["error"] = err