From e88d735cb637de85cfa483bac5717a4362a891cf Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Sun, 23 Dec 2012 11:02:51 -0800 Subject: [PATCH] Make configured VM providers default to an empty one --- lib/vagrant/environment.rb | 4 +--- plugins/kernel_v2/config/vm.rb | 6 +++++- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/lib/vagrant/environment.rb b/lib/vagrant/environment.rb index 4bd11f672..1087744fd 100644 --- a/lib/vagrant/environment.rb +++ b/lib/vagrant/environment.rb @@ -213,9 +213,7 @@ module Vagrant end # Get the provider configuration from the final loaded configuration - vm_provider = config.vm.providers[provider] - provider_config = nil - provider_config = vm_provider.config if vm_provider + provider_config = config.vm.providers[provider].config # Create the machine and cache it for future calls. This will also # return the machine from this method. diff --git a/plugins/kernel_v2/config/vm.rb b/plugins/kernel_v2/config/vm.rb index d39baf643..d59aea96e 100644 --- a/plugins/kernel_v2/config/vm.rb +++ b/plugins/kernel_v2/config/vm.rb @@ -28,8 +28,12 @@ module VagrantPlugins @forwarded_ports = [] @shared_folders = {} @networks = [] - @providers = {} @provisioners = [] + + # The providers hash defaults any key to a provider object + @providers = Hash.new do |hash, key| + hash[key] = VagrantConfigProvider.new(key, nil) + end end # Custom merge method since some keys here are merged differently.