fix(virtualbox) LoadSnapshots should succeed even if VM has no snapshots

This commit is contained in:
Brian Fox 2019-09-12 10:50:42 +02:00
parent 3175b72cf3
commit 5b6dcb0c94
1 changed files with 7 additions and 6 deletions

View File

@ -252,17 +252,18 @@ func (d *VBox42Driver) LoadSnapshots(vmName string) (*VBoxSnapshot, error) {
}
log.Printf("Executing LoadSnapshots: VM: %s", vmName)
var rootNode *VBoxSnapshot
stdoutString, err := d.VBoxManageWithOutput("snapshot", vmName, "list", "--machinereadable")
if stdoutString == "This machine does not have any snapshots" {
return rootNode, nil
}
if nil != err {
return nil, err
}
var rootNode *VBoxSnapshot
if stdoutString != "This machine does not have any snapshots" {
rootNode, err = ParseSnapshotData(stdoutString)
if nil != err {
return nil, err
}
rootNode, err = ParseSnapshotData(stdoutString)
if nil != err {
return nil, err
}
return rootNode, nil