lib/berkshelf/vagrant/config.rb in vagrant-berkshelf-1.4.0.dev1 vs lib/berkshelf/vagrant/config.rb in vagrant-berkshelf-2.0.0.rc1

- old
+ new

@@ -41,21 +41,23 @@ @enabled = File.exist?(@berksfile_path) end # @param [String] value def berksfile_path=(value) - @berksfile_path = File.expand_path(value) + @berksfile_path = value end # @param [String] value def client_key=(value) - @client_key = File.expand_path(value) + @client_key = value end alias_method :to_hash, :instance_variables_hash def validate(machine) + @berksfile_path = File.expand_path(@berksfile_path, machine.env.root_path.to_s) + @client_key = File.expand_path(@client_key, machine.env.root_path.to_s) errors = Array.new unless [TrueClass, FalseClass].include?(enabled.class) errors << "A value for berkshelf.enabled can be true or false." end @@ -71,11 +73,11 @@ if !except.empty? && !only.empty? errors << "A value for berkshelf.empty and berkshelf.only cannot both be defined." end - if machine.env.config_global.vm.provisioners.any? { |prov| prov.name == :chef_client } + if global_provisioners(machine).any? { |prov| prov.name == :chef_client } if machine.config.berkshelf.node_name.nil? errors << "A configuration must be set for chef.node_name when using the chef_client provisioner. Run 'berks configure' or edit your configuration." end if machine.config.berkshelf.client_key.nil? @@ -84,8 +86,14 @@ end end { "berkshelf configuration" => errors } end + + private + + def global_provisioners(machine) + machine.env.vagrantfile.config.vm.provisioners + end end end end