Backwards compatible with_target_vms, fix failing test

This commit is contained in:
Mitchell Hashimoto 2012-03-23 11:29:10 -04:00
parent ff36845259
commit 351f9757a1
2 changed files with 6 additions and 2 deletions

View File

@ -71,6 +71,10 @@ module Vagrant
# Setup the options hash # Setup the options hash
options ||= {} options ||= {}
# Require that names be an array
names ||= []
names = [names] if !names.is_a?(Array)
# First determine the proper array of VMs. # First determine the proper array of VMs.
vms = [] vms = []
if names.length > 0 if names.length > 0
@ -96,7 +100,7 @@ module Vagrant
else else
vms = @env.vms_ordered vms = @env.vms_ordered
end end
# Make sure we're only working with one VM if single target # Make sure we're only working with one VM if single target
raise Errors::MultiVMTargetRequired if options[:single_target] && vms.length != 1 raise Errors::MultiVMTargetRequired if options[:single_target] && vms.length != 1

View File

@ -54,7 +54,7 @@ module Vagrant
end end
def package_target(name, options) def package_target(name, options)
with_target_vms([ name ], :single_target => true) do |vm| with_target_vms(name, :single_target => true) do |vm|
raise Errors::VMNotCreatedError if !vm.created? raise Errors::VMNotCreatedError if !vm.created?
@logger.debug("Packaging VM: #{vm.name}") @logger.debug("Packaging VM: #{vm.name}")
package_vm(vm, options) package_vm(vm, options)