Commit 755db6f3 authored by Mitchell Hashimoto's avatar Mitchell Hashimoto

Merge pull request #1043 from databus23/create_floppy_error_handeling

common: fix error handeling when creating a floppy
parents 7e970a8c 2a3393ca
...@@ -66,7 +66,7 @@ func (s *StepCreateFloppy) Run(state multistep.StateBag) multistep.StepAction { ...@@ -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 { ...@@ -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
} }
......
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