Validate providers and provisioners!

This commit is contained in:
Mitchell Hashimoto 2013-01-18 12:56:19 -08:00
parent 3f3c7027aa
commit 515ed8f119
1 changed files with 21 additions and 1 deletions

View File

@ -1,6 +1,7 @@
require "pathname" require "pathname"
require "vagrant" require "vagrant"
require "vagrant/config/v2/util"
require File.expand_path("../vm_provider", __FILE__) require File.expand_path("../vm_provider", __FILE__)
require File.expand_path("../vm_provisioner", __FILE__) require File.expand_path("../vm_provisioner", __FILE__)
@ -144,7 +145,26 @@ module VagrantPlugins
end end
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 end
end end