builder/virtualbox/vm: fix dropped error

This commit is contained in:
Lars Lehtonen 2019-10-01 15:54:28 -07:00
parent dfaded3f80
commit 4a3a011310
No known key found for this signature in database
GPG Key ID: 8137D474EBCB04F2
1 changed files with 6 additions and 0 deletions

View File

@ -71,6 +71,12 @@ func (s *StepSetSnapshot) Cleanup(state multistep.StateBag) {
} else {
ui.Say(fmt.Sprintf("Reverting to snapshot %s on virtual machine %s", s.revertToSnapshot, s.Name))
snapshotTree, err := driver.LoadSnapshots(s.Name)
if err != nil {
err := fmt.Errorf("error loading virtual machine %s snapshots: %v", s.Name, err)
state.Put("error", err)
ui.Error(err.Error())
return
}
revertTo := snapshotTree.GetSnapshotByUUID(s.revertToSnapshot)
if nil == revertTo {
err := fmt.Errorf("Snapshot with UUID %s not found for VM %s", s.revertToSnapshot, s.Name)