From f7666df24b8134e8eef775d691416c5763b2e1de Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Wed, 12 Jan 2011 00:14:08 -0800 Subject: [PATCH] Fix 1.8.7 compatibility issue --- lib/vagrant/config/vm/provisioner.rb | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/lib/vagrant/config/vm/provisioner.rb b/lib/vagrant/config/vm/provisioner.rb index 48dce4435..485ec5e66 100644 --- a/lib/vagrant/config/vm/provisioner.rb +++ b/lib/vagrant/config/vm/provisioner.rb @@ -18,12 +18,17 @@ module Vagrant # Configures the provisioner if it can (if it is valid). def configure(options=nil, &block) + # We don't want ancestors to be searched. This is the default in 1.8, + # but not in 1.9, hence this hackery. + const_args = ["Config"] + const_args << false if RUBY_VERSION >= "1.9" + # We assume that every provisioner has a `Config` class beneath # it for configuring. - return if !@provisioner || !@provisioner.const_defined?("Config", false) + return if !@provisioner || !@provisioner.const_defined?(*const_args) # Instantiate the config class and configure it - @config = @provisioner.const_get("Config", false).new + @config = @provisioner.const_get(*const_args).new block.call(@config) if block # TODO: Deal with the options hash