Merge pull request #2750 from rickard-von-essen/issue-2743

Fixes #2743: Change log messages for step_forward_ssh
This commit is contained in:
Chris Bednarski 2016-01-21 13:28:44 -08:00
commit db0e098800
3 changed files with 7 additions and 7 deletions

View File

@ -22,7 +22,7 @@ func (s *stepForwardSSH) Run(state multistep.StateBag) multistep.StepAction {
config := state.Get("config").(*Config) config := state.Get("config").(*Config)
ui := state.Get("ui").(packer.Ui) ui := state.Get("ui").(packer.Ui)
log.Printf("Looking for available SSH port between %d and %d", config.SSHHostPortMin, config.SSHHostPortMax) log.Printf("Looking for available communicator (SSH, WinRM, etc) port between %d and %d", config.SSHHostPortMin, config.SSHHostPortMax)
var sshHostPort uint var sshHostPort uint
var offset uint = 0 var offset uint = 0
@ -46,7 +46,7 @@ func (s *stepForwardSSH) Run(state multistep.StateBag) multistep.StepAction {
} }
offset++ offset++
} }
ui.Say(fmt.Sprintf("Found port for SSH: %d.", sshHostPort)) ui.Say(fmt.Sprintf("Found port for communicator (SSH, WinRM, etc): %d.", sshHostPort))
// Save the port we're using so that future steps can use it // Save the port we're using so that future steps can use it
state.Put("sshHostPort", sshHostPort) state.Put("sshHostPort", sshHostPort)

View File

@ -36,9 +36,9 @@ func (s *StepExport) Run(state multistep.StateBag) multistep.StepAction {
// Clear out the Packer-created forwarding rule // Clear out the Packer-created forwarding rule
if !s.SkipNatMapping { if !s.SkipNatMapping {
ui.Message(fmt.Sprintf( ui.Message(fmt.Sprintf(
"Deleting forwarded port mapping for SSH (host port %d)", "Deleting forwarded port mapping for the communicator (SSH, WinRM, etc) (host port %d)",
state.Get("sshHostPort"))) state.Get("sshHostPort")))
command := []string{"modifyvm", vmName, "--natpf1", "delete", "packerssh"} command := []string{"modifyvm", vmName, "--natpf1", "delete", "packercomm"}
if err := driver.VBoxManage(command...); err != nil { if err := driver.VBoxManage(command...); err != nil {
err := fmt.Errorf("Error deleting port forwarding rule: %s", err) err := fmt.Errorf("Error deleting port forwarding rule: %s", err)
state.Put("error", err) state.Put("error", err)

View File

@ -35,7 +35,7 @@ func (s *StepForwardSSH) Run(state multistep.StateBag) multistep.StepAction {
guestPort := s.CommConfig.Port() guestPort := s.CommConfig.Port()
sshHostPort := guestPort sshHostPort := guestPort
if !s.SkipNatMapping { if !s.SkipNatMapping {
log.Printf("Looking for available SSH port between %d and %d", log.Printf("Looking for available communicator (SSH, WinRM, etc) port between %d and %d",
s.HostPortMin, s.HostPortMax) s.HostPortMin, s.HostPortMax)
offset := 0 offset := 0
@ -61,11 +61,11 @@ func (s *StepForwardSSH) Run(state multistep.StateBag) multistep.StepAction {
} }
// Create a forwarded port mapping to the VM // Create a forwarded port mapping to the VM
ui.Say(fmt.Sprintf("Creating forwarded port mapping for SSH (host port %d)", sshHostPort)) ui.Say(fmt.Sprintf("Creating forwarded port mapping for communicator (SSH, WinRM, etc) (host port %d)", sshHostPort))
command := []string{ command := []string{
"modifyvm", vmName, "modifyvm", vmName,
"--natpf1", "--natpf1",
fmt.Sprintf("packerssh,tcp,127.0.0.1,%d,,%d", sshHostPort, guestPort), fmt.Sprintf("packercomm,tcp,127.0.0.1,%d,,%d", sshHostPort, guestPort),
} }
if err := driver.VBoxManage(command...); err != nil { if err := driver.VBoxManage(command...); err != nil {
err := fmt.Errorf("Error creating port forwarding rule: %s", err) err := fmt.Errorf("Error creating port forwarding rule: %s", err)