Commit ac029d9e authored by Mitchell Hashimoto's avatar Mitchell Hashimoto

builder/vmware: Use proper pausefn

parent e0f2bcf8
package common
import (
"fmt"
"github.com/mitchellh/multistep"
"github.com/mitchellh/packer/packer"
)
// MultistepDebugFn will return a proper multistep.DebugPauseFn to
// use for debugging if you're using multistep in your builder.
func MultistepDebugFn(ui packer.Ui) multistep.DebugPauseFn {
return func(loc multistep.DebugLocation, name string, state map[string]interface{}) {
var locationString string
switch loc {
case multistep.DebugLocationAfterRun:
locationString = "after run of"
case multistep.DebugLocationBeforeCleanup:
locationString = "before cleanup of"
default:
locationString = "at"
}
message := fmt.Sprintf(
"Pausing %s step '%s'. Press any key to continue.\n",
locationString, name)
ui.Say(message)
ui.Ask("")
}
}
...@@ -5,6 +5,7 @@ import ( ...@@ -5,6 +5,7 @@ import (
"fmt" "fmt"
"github.com/mitchellh/mapstructure" "github.com/mitchellh/mapstructure"
"github.com/mitchellh/multistep" "github.com/mitchellh/multistep"
"github.com/mitchellh/packer/builder/common"
"github.com/mitchellh/packer/packer" "github.com/mitchellh/packer/packer"
"log" "log"
"math/rand" "math/rand"
...@@ -217,7 +218,10 @@ func (b *Builder) Run(ui packer.Ui, hook packer.Hook, cache packer.Cache) (packe ...@@ -217,7 +218,10 @@ func (b *Builder) Run(ui packer.Ui, hook packer.Hook, cache packer.Cache) (packe
// Run! // Run!
if b.config.PackerDebug { if b.config.PackerDebug {
b.runner = &multistep.DebugRunner{Steps: steps} b.runner = &multistep.DebugRunner{
Steps: steps,
PauseFn: common.MultistepDebugFn(ui),
}
} else { } else {
b.runner = &multistep.BasicRunner{Steps: steps} b.runner = &multistep.BasicRunner{Steps: steps}
} }
......
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