Use the proper config version in config.vm.define calls

This commit is contained in:
Mitchell Hashimoto 2013-01-30 19:24:09 -08:00
parent bb97351060
commit 9156be0f84
3 changed files with 14 additions and 12 deletions

View File

@ -75,6 +75,10 @@ module VagrantPlugins
end end
def define(name, options=nil, &block) def define(name, options=nil, &block)
# Force the V1 config on these calls
options ||= {}
options[:config_version] = "1"
@define_calls << [name, options, block] @define_calls << [name, options, block]
end end

View File

@ -115,6 +115,7 @@ module VagrantPlugins
def define(name, options=nil, &block) def define(name, options=nil, &block)
name = name.to_sym name = name.to_sym
options ||= {} options ||= {}
options[:config_version] ||= "2"
# Add the name to the array of VM keys. This array is used to # Add the name to the array of VM keys. This array is used to
# preserve the order in which VMs are defined. # preserve the order in which VMs are defined.
@ -126,7 +127,7 @@ module VagrantPlugins
end end
defined_vms[name].options.merge!(options) defined_vms[name].options.merge!(options)
defined_vms[name].push_proc(&block) if block defined_vms[name].config_procs << [options[:config_version], block] if block
end end
def finalize! def finalize!

View File

@ -6,20 +6,17 @@ module VagrantPlugins
class VagrantConfigSubVM class VagrantConfigSubVM
include Vagrant::Util::StackedProcRunner include Vagrant::Util::StackedProcRunner
# Returns an array of the configuration procs in [version, proc]
# format.
#
# @return [Array]
attr_reader :config_procs
attr_reader :options attr_reader :options
def initialize def initialize
@options = {} @config_procs = []
end @options = {}
# This returns an array of the procs to configure this VM, with
# the proper version pre-pended for the configuration loader.
#
# @return [Array]
def config_procs
proc_stack.map do |proc|
["2", proc]
end
end end
end end
end end