Commit 5b6140b2 authored by Kristopher Ruzic's avatar Kristopher Ruzic

fix up

parent 60bbe850
......@@ -105,6 +105,7 @@ type Config struct {
ShutdownCommand string `mapstructure:"shutdown_command"`
SSHHostPortMin uint `mapstructure:"ssh_host_port_min"`
SSHHostPortMax uint `mapstructure:"ssh_host_port_max"`
VncIP string `mapstructure:"vnc_ip"`
VNCPortMin uint `mapstructure:"vnc_port_min"`
VNCPortMax uint `mapstructure:"vnc_port_max"`
VMName string `mapstructure:"vm_name"`
......@@ -354,10 +355,15 @@ func (b *Builder) Prepare(raws ...interface{}) ([]string, error) {
"a checksum is highly recommended.")
}
if b.config.VncIP == "" {
warnings = append(warnings,
"No VNC IP address specified, will default to 127.0.0.1")
b.config.VncIP = "127.0.0.1"
}
if errs != nil && len(errs.Errors) > 0 {
return warnings, errs
}
return warnings, nil
}
......
......@@ -40,10 +40,12 @@ func (s *stepTypeBootCommand) Run(state multistep.StateBag) multistep.StepAction
httpPort := state.Get("http_port").(uint)
ui := state.Get("ui").(packer.Ui)
vncPort := state.Get("vnc_port").(uint)
vncAddr := state.Get("vnc_ip").(string)
// Connect to VNC
ui.Say("Connecting to VM via VNC")
nc, err := net.Dial("tcp", fmt.Sprintf("127.0.0.1:%d", vncPort))
// tbh why is this hardcoded anyway?
nc, err := net.Dial("tcp", fmt.Sprintf("%s:%d", vncAddr, vncPort))
if err != nil {
err := fmt.Errorf("Error connecting to VNC: %s", err)
state.Put("error", err)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment