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:
commit
2e58b807de
|
@ -252,18 +252,19 @@ func (d *VBox42Driver) LoadSnapshots(vmName string) (*VBoxSnapshot, error) {
|
||||||
}
|
}
|
||||||
log.Printf("Executing LoadSnapshots: VM: %s", vmName)
|
log.Printf("Executing LoadSnapshots: VM: %s", vmName)
|
||||||
|
|
||||||
|
var rootNode *VBoxSnapshot
|
||||||
stdoutString, err := d.VBoxManageWithOutput("snapshot", vmName, "list", "--machinereadable")
|
stdoutString, err := d.VBoxManageWithOutput("snapshot", vmName, "list", "--machinereadable")
|
||||||
|
if stdoutString == "This machine does not have any snapshots" {
|
||||||
|
return rootNode, nil
|
||||||
|
}
|
||||||
if nil != err {
|
if nil != err {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
var rootNode *VBoxSnapshot
|
|
||||||
if stdoutString != "This machine does not have any snapshots" {
|
|
||||||
rootNode, err = ParseSnapshotData(stdoutString)
|
rootNode, err = ParseSnapshotData(stdoutString)
|
||||||
if nil != err {
|
if nil != err {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
return rootNode, nil
|
return rootNode, nil
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue