diff --git a/lib/vagrant/command/package.rb b/lib/vagrant/command/package.rb index a1da93b8a..36cab487d 100644 --- a/lib/vagrant/command/package.rb +++ b/lib/vagrant/command/package.rb @@ -17,14 +17,24 @@ module Vagrant def package_base vm = VM.find(options[:base], env) raise VMNotFoundError.new("Specified base VM not found: #{options[:base]}") if !vm.created? - vm.package(options) + package_vm(vm) end def package_target raise MultiVMTargetRequired.new("`vagrant package` requires the name of the VM to package in a multi-vm environment.") if target_vms.length > 1 vm = target_vms.first raise VMNotCreatedError.new("The VM must be created to package it. Run `vagrant up` first.") if !vm.created? - vm.package(options) + package_vm(vm) + end + + def package_vm(vm) + opts = options.inject({}) do |acc, data| + k,v = data + acc["package.#{k}"] = v + acc + end + + vm.package(opts) end end end