Change step name to better illustrate purpose of step

This commit is contained in:
DanHam 2018-07-08 22:24:06 +01:00
parent b386e567db
commit 00276f2f64
No known key found for this signature in database
GPG Key ID: 58E79AEDD6AA987E
3 changed files with 11 additions and 11 deletions

View File

@ -10,23 +10,23 @@ import (
"github.com/hashicorp/packer/packer"
)
type StepCreateTempDir struct {
type StepCreateBuildDir struct {
// User supplied directory under which we create the main build
// directory. The build directory is used to house the VM files and
// directory. The build directory is used to house the VM files and
// folders during the build. If unspecified the default temp directory
// for the OS is used
TempPath string
// The full path to the build directory. This is concatenation of
// The full path to the build directory. This is the concatenation of
// TempPath plus a directory uniquely named for the build
dirPath string
}
// Creates the main directory used to house the VMs files and folders
// during the build
func (s *StepCreateTempDir) Run(_ context.Context, state multistep.StateBag) multistep.StepAction {
func (s *StepCreateBuildDir) Run(_ context.Context, state multistep.StateBag) multistep.StepAction {
ui := state.Get("ui").(packer.Ui)
ui.Say("Creating temporary directory...")
ui.Say("Creating build directory...")
if s.TempPath == "" {
s.TempPath = os.TempDir()
@ -34,7 +34,7 @@ func (s *StepCreateTempDir) Run(_ context.Context, state multistep.StateBag) mul
packerTempDir, err := ioutil.TempDir(s.TempPath, "packerhv")
if err != nil {
err := fmt.Errorf("Error creating temporary directory: %s", err)
err := fmt.Errorf("Error creating build directory: %s", err)
state.Put("error", err)
ui.Error(err.Error())
return multistep.ActionHalt
@ -47,16 +47,16 @@ func (s *StepCreateTempDir) Run(_ context.Context, state multistep.StateBag) mul
}
// Cleanup removes the build directory
func (s *StepCreateTempDir) Cleanup(state multistep.StateBag) {
func (s *StepCreateBuildDir) Cleanup(state multistep.StateBag) {
if s.dirPath == "" {
return
}
ui := state.Get("ui").(packer.Ui)
ui.Say("Deleting temporary directory...")
ui.Say("Deleting build directory...")
err := os.RemoveAll(s.dirPath)
if err != nil {
ui.Error(fmt.Sprintf("Error deleting temporary directory: %s", err))
ui.Error(fmt.Sprintf("Error deleting build directory: %s", err))
}
}

View File

@ -350,7 +350,7 @@ func (b *Builder) Run(ui packer.Ui, hook packer.Hook, cache packer.Cache) (packe
state.Put("ui", ui)
steps := []multistep.Step{
&hypervcommon.StepCreateTempDir{
&hypervcommon.StepCreateBuildDir{
TempPath: b.config.TempPath,
},
&hypervcommon.StepOutputDir{

View File

@ -362,7 +362,7 @@ func (b *Builder) Run(ui packer.Ui, hook packer.Hook, cache packer.Cache) (packe
state.Put("ui", ui)
steps := []multistep.Step{
&hypervcommon.StepCreateTempDir{},
&hypervcommon.StepCreateBuildDir{},
&hypervcommon.StepOutputDir{
Force: b.config.PackerForce,
Path: b.config.OutputDir,