Merge pull request #1043 from databus23/create_floppy_error_handeling

common: fix error handeling when creating a floppy
This commit is contained in:
Mitchell Hashimoto 2014-04-17 14:43:22 -07:00
commit 755db6f332
1 changed files with 2 additions and 2 deletions

View File

@ -66,7 +66,7 @@ func (s *StepCreateFloppy) Run(state multistep.StateBag) multistep.StepAction {
Label: "packer", Label: "packer",
OEMName: "packer", OEMName: "packer",
} }
if fat.FormatSuperFloppy(device, formatConfig); err != nil { if err := fat.FormatSuperFloppy(device, formatConfig); err != nil {
state.Put("error", fmt.Errorf("Error creating floppy: %s", err)) state.Put("error", fmt.Errorf("Error creating floppy: %s", err))
return multistep.ActionHalt return multistep.ActionHalt
} }
@ -90,7 +90,7 @@ func (s *StepCreateFloppy) Run(state multistep.StateBag) multistep.StepAction {
// Go over each file and copy it. // Go over each file and copy it.
for _, filename := range s.Files { for _, filename := range s.Files {
ui.Message(fmt.Sprintf("Copying: %s", filepath.Base(filename))) ui.Message(fmt.Sprintf("Copying: %s", filepath.Base(filename)))
if s.addSingleFile(rootDir, filename); err != nil { if err := s.addSingleFile(rootDir, filename); err != nil {
state.Put("error", fmt.Errorf("Error adding file to floppy: %s", err)) state.Put("error", fmt.Errorf("Error adding file to floppy: %s", err))
return multistep.ActionHalt return multistep.ActionHalt
} }