CHEF中的条件依赖关系

我有一个复杂的软件堆栈,我用2个配方pipe理。

recipe[stack::foo] recipe[stack::bar] 

foo安装在每台服务器上,而bar仅安装在一部分服务器上。 bar取决于文件和服务foo

配方[堆栈:: foo的]

  file 'fooFile' do source 'somewhere' notifies :restart, service[barService] #bar needs to be restart first, if it is present notifies :restart, service[fooService] end service 'fooService' do action :start end 

配方[堆栈::巴]

  file 'barFile' do source 'somewhere' end service 'barService' do action :start end 

是否可以创build条件依赖项,以便如果bar配方存在于节点上,则会重新启动它。 如果不是,它会跳过它。

我正在尝试这样的事情

  file 'fooFile' do source 'somewhere' notifies :restart, service[barService] if exists? "service[barService]" notifies :restart, service[fooService] end 

在IRC回答,用户spuder通知,不要鼓励重复询问。

tl; dr使用resources()或检查运行列表。