plugins/commands/snapshot/command/save.rb in vagrant-unbundled-2.2.5.0 vs plugins/commands/snapshot/command/save.rb in vagrant-unbundled-2.2.6.0
- old
+ new
@@ -29,10 +29,18 @@
if argv.empty? || argv.length > 2
raise Vagrant::Errors::CLIInvalidUsage,
help: opts.help.chomp
end
- name = argv.pop
+ # If no snapshot name is given, the backup name is the same as the machine name.
+ # If there is a name given, we need to remove it and save it as `name`. Otherwise
+ # `with_target_vms` will treat the snapshot name as a guest name.
+ if argv.size < 2
+ name = argv.first
+ else
+ name = argv.pop
+ end
+
with_target_vms(argv) do |vm|
if !vm.provider.capability?(:snapshot_list)
raise Vagrant::Errors::SnapshotNotSupported
end