From 515ed8f119f34e5659af8ecac5f254bef2c6ec0b Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Fri, 18 Jan 2013 12:56:19 -0800 Subject: [PATCH] Validate providers and provisioners! --- plugins/kernel_v2/config/vm.rb | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/plugins/kernel_v2/config/vm.rb b/plugins/kernel_v2/config/vm.rb index 7a33c4e80..eda7f4117 100644 --- a/plugins/kernel_v2/config/vm.rb +++ b/plugins/kernel_v2/config/vm.rb @@ -1,6 +1,7 @@ require "pathname" require "vagrant" +require "vagrant/config/v2/util" require File.expand_path("../vm_provider", __FILE__) require File.expand_path("../vm_provisioner", __FILE__) @@ -144,7 +145,26 @@ module VagrantPlugins end end - { "vm" => errors } + # We're done with VM level errors so prepare the section + errors = { "vm" => errors } + + # Validate providers + @providers.each do |_name, vm_provider| + if vm_provider.config + provider_errors = vm_provider.config.validate(machine) + errors = Vagrant::Config::V2::Util.merge_errors(errors, provider_errors) + end + end + + # Validate provisioners + @provisioners.each do |vm_provisioner| + if vm_provisioner.config + provisioner_errors = vm_provisioner.config.validate(machine) + errors = Vagrant::Config::V2::Util.merge_errors(errors, provisioner_errors) + end + end + + errors end end end