Merge pull request #8177 from alrs/virtualbox-builder-dropped-error

builder/virtualbox/vm: fix dropped error
This commit is contained in:
Megan Marsh 2019-10-02 13:00:39 -07:00 committed by GitHub
commit c138edcbe1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
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)