简体   繁体   中英

Check if chef is running as chef-solo

I'm using Vagrant and chef-solo to test my cookbooks, but I have one particular recipe that requires chef-server (it uses search). I'd like my default recipe to look like the following:

include_recipe 'some_recipe'
include_recipe 'some_other_recipe'
unless running_as_chef_solo?
  include_recipe 'a_recipe_that_requires_chef_server'
end

How can I check whether chef is running as chef-solo from within a cookbook, so I can skip unsupported recipes?

Use the Chef::Config object:

unless Chef::Config[:solo]
  include_recipe 'a_recipe_that_requires_chef_server'
end

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM