Merge pull request #7092 from arizvisa/vmware-builders.halt-duplicate-code

Tiny fix to replace some duplicate code with usage of the already defined `halt` closure in the StepCloneVMX step for the vmware-vmx builder.
This commit is contained in:
Adrien Delorme 2018-12-11 11:53:26 +01:00 committed by GitHub
commit 5e5ed9793f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 4 deletions

View File

@ -39,9 +39,7 @@ func (s *StepCloneVMX) Run(_ context.Context, state multistep.StateBag) multiste
log.Printf("Cloning to: %s", vmxPath) log.Printf("Cloning to: %s", vmxPath)
if err := driver.Clone(vmxPath, s.Path, s.Linked); err != nil { if err := driver.Clone(vmxPath, s.Path, s.Linked); err != nil {
state.Put("error", err)
return halt(err) return halt(err)
} }
// Read in the machine configuration from the cloned VMX file // Read in the machine configuration from the cloned VMX file
@ -102,8 +100,7 @@ func (s *StepCloneVMX) Run(_ context.Context, state multistep.StateBag) multiste
} }
if len(diskFullPaths) == 0 { if len(diskFullPaths) == 0 {
state.Put("error", fmt.Errorf("Could not enumerate disk info from the vmx file")) return halt(fmt.Errorf("Could not enumerate disk info from the vmx file"))
return multistep.ActionHalt
} }
// Determine the network type by reading out of the .vmx // Determine the network type by reading out of the .vmx