include datetime in list command
bubenkoff opened this issue · 2 comments
When you have a list like this:
it's critical to see the datetime of each snapshot, this info is available from vbox api for sure
please implement subj feature
That would be a nice thing to have, and I briefly looked into it.
I am deliberately choosing to keep vagrant-vbox-snapshot as a simple wrapper on VBoxManage, the command-line utility for interacting with VirtualBox. Unfortunately it doesn't seem to support giving us dates:
$ VBoxManage snapshot 4e9ebfe7-4da1-44f8-b8f4-2613fa18c794 list
Name: TEST1 (UUID: d12c8552-e27d-4b76-855a-ef35535e934d)
Name: TEST2 (UUID: d4190710-c716-47d9-a8fd-0d78bde5993e) *
$ VBoxManage snapshot 4e9ebfe7-4da1-44f8-b8f4-2613fa18c794 list --details
Name: TEST1 (UUID: d12c8552-e27d-4b76-855a-ef35535e934d)
Name: TEST2 (UUID: d4190710-c716-47d9-a8fd-0d78bde5993e) *
I'm not sure if it's a bug that --details
doesn't actually do anything, or a feature, but there you have it.
For the record, the no-longer-maintained repo https://github.com/t9md/vagrant-snap/blob/master/lib/vagrant_snap.rb seems to use the virtualbox ruby gem to extract this info somehow.
See https://github.com/t9md/vagrant-snap/blob/master/lib/vagrant_snap.rb#L48
In my opinion, it's not worth adding the gem dependency and maintenance overhead, even if it allows for more features like this one. Though I'd consider a pull request implementing it, I'd discourage it.
As a workaround, I recommend naming your snapshots under some scheme, and if necessary fall back to the UI:
Actually it turns out VBoxManage snapshot <uuid> list --details
will print out descriptions, if they were set. So we can get dates in as follows:
- Modify
vagrant snapshot take
to write the current timestamp into the description - Implement
vagrant snapshot list --details
argument.
Output will look like this:
$ VBoxManage snapshot c19950ee-9b3e-4018-a771-665cf95d09b2 list --details
Name: TEST1 (UUID: c95a4fda-e9d1-42e7-b77a-1226cc266a42)
Description:
Taken at 10:25AM
Name: TEST2 (UUID: 278e4e7b-26cf-4a47-a541-c660c9e2a60d) *
The line breaks are really ugly, but that's VBoxManage for you. We could try to do something more complicated, but that's going to be too much work to maintain.
Pull requests welcome.