检查厨师是否以厨师独奏的形式运行

And*_*ewF 13 chef-infra chef-recipe vagrant

我正在使用Vagrant和chef-solo来测试我的食谱,但我有一个特殊的食谱需要厨师服务器(它使用搜索).我希望我的默认配方如下所示:

include_recipe 'some_recipe'
include_recipe 'some_other_recipe'
unless running_as_chef_solo?
  include_recipe 'a_recipe_that_requires_chef_server'
end
Run Code Online (Sandbox Code Playgroud)

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

cmu*_*ur2 23

使用Chef::Config对象:

unless Chef::Config[:solo]
  include_recipe 'a_recipe_that_requires_chef_server'
end
Run Code Online (Sandbox Code Playgroud)