virtualbox/common: style

This commit is contained in:
Mitchell Hashimoto 2015-06-10 10:50:08 -07:00
parent 8d6a99457a
commit bd04b52b32
2 changed files with 5 additions and 11 deletions

View File

@ -31,12 +31,10 @@ func (s *StepExport) Run(state multistep.StateBag) multistep.StepAction {
// Wait a second to ensure VM is really shutdown.
log.Println("1 second timeout to ensure VM is really shutdown")
time.Sleep(1 * time.Second)
ui.Say("Preparing to export machine...")
// Clear out the Packer-created forwarding rule
ui.Say("Preparing to export machine...")
var command []string
if s.SkipNatMapping == false {
if !s.SkipNatMapping {
ui.Message(fmt.Sprintf(
"Deleting forwarded port mapping for SSH (host port %d)",
state.Get("sshHostPort")))
@ -52,13 +50,12 @@ func (s *StepExport) Run(state multistep.StateBag) multistep.StepAction {
// Export the VM to an OVF
outputPath := filepath.Join(s.OutputDir, vmName+"."+s.Format)
command = []string{
command := []string{
"export",
vmName,
"--output",
outputPath,
}
command = append(command, s.ExportOpts...)
ui.Say("Exporting virtual machine...")

View File

@ -30,11 +30,8 @@ func (s *StepForwardSSH) Run(state multistep.StateBag) multistep.StepAction {
ui := state.Get("ui").(packer.Ui)
vmName := state.Get("vmName").(string)
var sshHostPort uint
if s.SkipNatMapping {
sshHostPort = s.GuestPort
log.Printf("Skipping SSH NAT mapping and using SSH port %d", sshHostPort)
} else {
sshHostPort := s.GuestPort
if !s.SkipNatMapping {
log.Printf("Looking for available SSH port between %d and %d",
s.HostPortMin, s.HostPortMax)
var offset uint = 0