Fix chef configuration

This commit is contained in:
Mitchell Hashimoto 2011-12-14 23:22:10 -08:00
parent e602af8c3a
commit a23ebf7220
3 changed files with 8 additions and 2 deletions

View File

@ -1,3 +1,5 @@
require 'log4r'
module Vagrant module Vagrant
module Config module Config
class VMConfig < Base class VMConfig < Base
@ -8,11 +10,14 @@ module Vagrant
attr_reader :config attr_reader :config
def initialize(shortcut, options=nil, &block) def initialize(shortcut, options=nil, &block)
@logger = Log4r::Logger.new("vagrant::config::vm::provisioner")
@logger.debug("Provisioner config: #{shortcut}")
@shortcut = shortcut @shortcut = shortcut
@provisioner = shortcut @provisioner = shortcut
@provisioner = Vagrant.provisioners.get(shortcut) if shortcut.is_a?(Symbol) @provisioner = Vagrant.provisioners.get(shortcut) if shortcut.is_a?(Symbol)
@config = nil @config = nil
@logger.info("Provisioner class: #{provisioner}")
configure(options, &block) if @provisioner configure(options, &block) if @provisioner
end end
@ -21,6 +26,7 @@ module Vagrant
config_class = @provisioner.config_class config_class = @provisioner.config_class
return if !config_class return if !config_class
@logger.debug("Configuring provisioner with: #{config_class}")
@config = config_class.new @config = config_class.new
@config.set_options(options) if options @config.set_options(options) if options
block.call(@config) if block block.call(@config) if block

View File

@ -29,7 +29,7 @@ module Vagrant
@encrypted_data_bag_secret = "/tmp/encrypted_data_bag_secret" @encrypted_data_bag_secret = "/tmp/encrypted_data_bag_secret"
end end
def validate(errors) def validate(env, errors)
super super
errors.add(I18n.t("vagrant.config.chef.server_url_empty")) if !chef_server_url || chef_server_url.strip == "" errors.add(I18n.t("vagrant.config.chef.server_url_empty")) if !chef_server_url || chef_server_url.strip == ""

View File

@ -23,7 +23,7 @@ module Vagrant
@nfs = false @nfs = false
end end
def validate(errors) def validate(env, errors)
super super
errors.add(I18n.t("vagrant.config.chef.cookbooks_path_empty")) if !cookbooks_path || [cookbooks_path].flatten.empty? errors.add(I18n.t("vagrant.config.chef.cookbooks_path_empty")) if !cookbooks_path || [cookbooks_path].flatten.empty?