2013-03-09 118 views
12

我使用流浪和厨师独奏来测试我的食谱,但我有一个需要厨师服务器(它使用搜索)的特定配方。我想我的默认配方如下所示:检查厨师是否作为厨师独奏运行

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

如何检查是否厨师是从食谱中运行的厨师独奏,所以我可以跳过不支持的食谱?

回答

23

使用Chef::Config对象:

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