Node-Virtualization/node-virtualbox

Empty snapshot list

frollo opened this issue · 1 comments

I'm using version 5.1.22r115126 of VBoxManage on Windows 10.

When I try to run snapshotList for my VMs, I get an error object if there are no snapshot for a VM, but if there are snapshots, the returned array is empty, and the UUID is undefined.

If I try to get the snapshots from the CLI (using "C:\Program Files\Oracle\VirtualBox\\VBoxManage.exe" snapshot "2e996f4f-ca83-4e0f-bf7d-fd8d3d8c93e3" list --machinereadable) I get the following output:

SnapshotName="Istantanea 1"
SnapshotUUID="c3dee892-28f7-475a-ba8a-bac2b98cfac8"
CurrentSnapshotName="Istantanea 1"
CurrentSnapshotUUID="c3dee892-28f7-475a-ba8a-bac2b98cfac8"
CurrentSnapshotNode="SnapshotName"

Found a fix for quick fix for this. On line 192 of lib\virtualbox.js change

line.replace(/^(CurrentSnapshotUUID|SnapshotName|SnapshotUUID).*\="(.*)"$/, function(l, k, v) {

to

line.trim().replace(/^(CurrentSnapshotUUID|SnapshotName|SnapshotUUID).*\="(.*)"$/, function(l, k, v) {

Issue probably has to do with Windows new lines.