From 9156be0f84926fd8b9c42d23ff8ff9089f7fd905 Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Wed, 30 Jan 2013 19:24:09 -0800 Subject: [PATCH] Use the proper config version in config.vm.define calls --- plugins/kernel_v1/config/vm.rb | 4 ++++ plugins/kernel_v2/config/vm.rb | 3 ++- plugins/kernel_v2/config/vm_subvm.rb | 19 ++++++++----------- 3 files changed, 14 insertions(+), 12 deletions(-) diff --git a/plugins/kernel_v1/config/vm.rb b/plugins/kernel_v1/config/vm.rb index e1cb36d0d..508039939 100644 --- a/plugins/kernel_v1/config/vm.rb +++ b/plugins/kernel_v1/config/vm.rb @@ -75,6 +75,10 @@ module VagrantPlugins end def define(name, options=nil, &block) + # Force the V1 config on these calls + options ||= {} + options[:config_version] = "1" + @define_calls << [name, options, block] end diff --git a/plugins/kernel_v2/config/vm.rb b/plugins/kernel_v2/config/vm.rb index fea460837..cc82e3fd5 100644 --- a/plugins/kernel_v2/config/vm.rb +++ b/plugins/kernel_v2/config/vm.rb @@ -115,6 +115,7 @@ module VagrantPlugins def define(name, options=nil, &block) name = name.to_sym options ||= {} + options[:config_version] ||= "2" # Add the name to the array of VM keys. This array is used to # preserve the order in which VMs are defined. @@ -126,7 +127,7 @@ module VagrantPlugins end 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 def finalize! diff --git a/plugins/kernel_v2/config/vm_subvm.rb b/plugins/kernel_v2/config/vm_subvm.rb index 234cfb475..d26e8fb65 100644 --- a/plugins/kernel_v2/config/vm_subvm.rb +++ b/plugins/kernel_v2/config/vm_subvm.rb @@ -6,20 +6,17 @@ module VagrantPlugins class VagrantConfigSubVM include Vagrant::Util::StackedProcRunner + # Returns an array of the configuration procs in [version, proc] + # format. + # + # @return [Array] + attr_reader :config_procs + attr_reader :options def initialize - @options = {} - end - - # 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 + @config_procs = [] + @options = {} end end end