Make include and output work with `vagrant package`

This commit is contained in:
Mitchell Hashimoto 2010-08-25 00:11:59 -07:00
parent 76715424fa
commit ae516c6d6f
1 changed files with 12 additions and 2 deletions

View File

@ -17,14 +17,24 @@ module Vagrant
def package_base def package_base
vm = VM.find(options[:base], env) vm = VM.find(options[:base], env)
raise VMNotFoundError.new("Specified base VM not found: #{options[:base]}") if !vm.created? raise VMNotFoundError.new("Specified base VM not found: #{options[:base]}") if !vm.created?
vm.package(options) package_vm(vm)
end end
def package_target 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 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 vm = target_vms.first
raise VMNotCreatedError.new("The VM must be created to package it. Run `vagrant up` first.") if !vm.created? 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 end
end end