2013-03-09 152 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