I have tried multiple times without any luck to get this code to run in my Vagrantfile, and each time I get the following error message:

There are errors in the configuration of this machine. Please fix
the following errors and try again:

chef solo provisioner:
* The following settings don't exist: add_recipe 

Here is the section of code I am referring to:

config.berkshelf.enabled = true
config.vm.provision :chef_solo do |chef|
  chef.add_recipe = 'apache2'
end

I've downloaded the latest version from this site (version 1.2.2) and installed the .pgk file on my Mac without error.

I've also made sure that I've successfully installed chef-11.4.4, and run this both with the Vagrant box running and not running... still get the same error.

I'm brand new to this technology, so any help and/or suggestions would be GREATLY appreciated. Thanks!

有帮助吗?

解决方案

The add_recipe method is a regular method, not an accessor, i.e. it is not add_recipe=. Thus, you can add recipes by using this code:

config.vm.provision :chef_solo do |chef|
  chef.add_recipe 'apache2'
end

Consequently, you can call that multiple times to add additional recipes (or add them as additional parameters).

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top