diff --git a/builder/vmware/builder.go b/builder/vmware/builder.go index 3e8c7eca9..260382e63 100644 --- a/builder/vmware/builder.go +++ b/builder/vmware/builder.go @@ -55,7 +55,7 @@ func (b *Builder) Run(ui packer.Ui, hook packer.Hook) packer.Artifact { &stepHTTPServer{}, &stepRun{}, &stepTypeBootCommand{}, - &stepWaitForIP{}, + &stepWaitForSSH{}, } // Setup the state bag diff --git a/builder/vmware/guest_ip.go b/builder/vmware/guest_ip.go new file mode 100644 index 000000000..96c6bfa45 --- /dev/null +++ b/builder/vmware/guest_ip.go @@ -0,0 +1,20 @@ +package vmware + +// Interface to help find the IP address of a running virtual machine. +type GuestIPFinder interface { + GuestIP() (string, error) +} + +// DHCPLeaseGuestLookup looks up the IP address of a guest using DHCP +// lease information from the VMware network devices. +type DHCPLeaseGuestLookup struct { + // Device that the guest is connected to. + Device string + + // MAC address of the guest. + MACAddress string +} + +func (f *DHCPLeaseGuestLookup) GuestIP() (string, error) { + return "", nil +} diff --git a/builder/vmware/step_wait_for_ip.go b/builder/vmware/step_wait_for_ip.go deleted file mode 100644 index e5fe5aa93..000000000 --- a/builder/vmware/step_wait_for_ip.go +++ /dev/null @@ -1,27 +0,0 @@ -package vmware - -import ( - "github.com/mitchellh/multistep" - "github.com/mitchellh/packer/packer" -) - -// This step creates the virtual disks for the VM. -// -// Uses: -// config *config -// ui packer.Ui -// -// Produces: -// -type stepWaitForIP struct{} - -func (stepWaitForIP) Run(state map[string]interface{}) multistep.StepAction { - ui := state["ui"].(packer.Ui) - - ui.Say("Waiting for SSH to become available...") - select {} - - return multistep.ActionContinue -} - -func (stepWaitForIP) Cleanup(map[string]interface{}) {} diff --git a/builder/vmware/step_wait_for_ssh.go b/builder/vmware/step_wait_for_ssh.go new file mode 100644 index 000000000..e2232e67d --- /dev/null +++ b/builder/vmware/step_wait_for_ssh.go @@ -0,0 +1,31 @@ +package vmware + +import ( + "github.com/mitchellh/multistep" + "github.com/mitchellh/packer/packer" +) + +// This step waits for SSH to become available and establishes an SSH +// connection. +// +// Uses: +// config *config +// ui packer.Ui +// +// Produces: +// +type stepWaitForSSH struct{} + +func (stepWaitForSSH) Run(state map[string]interface{}) multistep.StepAction { + ui := state["ui"].(packer.Ui) + + ui.Say("Waiting for SSH to become available...") + + for { + // First we wait for the IP to become available... + } + + return multistep.ActionContinue +} + +func (stepWaitForSSH) Cleanup(map[string]interface{}) {}