dergachev/vagrant-vbox-snapshot

vagrant snapshot list exits nastily when no snapshots

Closed this issue · 1 comments

If I have a box with no snapshots and I run vagrant snapshot list, I get the following error:

Listing snapshots for 'default':
There was an error while executing VBoxManage, a CLI used by Vagrant
for controlling VirtualBox. The command and stderr is shown below.

Command: ["snapshot", "298593d1-aa89-4e7b-9a7d-cbcc4ded2c1b", "list", "--details"]

Stderr: VBoxManage: error: This machine does not have any snapshots
VBoxManage: error: Details: code NS_ERROR_FAILURE (0x80004005), component Machine, interface IMachine, callee nsISupports
Context: "FindSnapshot(Bstr().raw(), ptrSnapshot.asOutParam())" at line 192 of file VBoxManageSnapshot.cpp

and I get an exit code of 1.

To my mind, having no snapshots is not a failure for a list command. I would have thought it would just print out nothing, or perhaps just echo 'no snapshots' and exit with 0.

Duplicate of #17, so closing.

Point well taken, I'll re-open that one and think harder about how to implement this gracefully, given Vagrant's behavior is really causing the issue rather than our code.