Merge pull request #8096 from onematchfox/virtualbox-snapshot

fix(virtualbox-vm) LoadSnapshots should succeed even if machine has no snapshots
This commit is contained in:
Adrien Delorme 2019-09-12 13:18:46 +02:00 committed by GitHub
commit 2e58b807de
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
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