Reputation: 6711
I have a wrapper cookbook that includes postgresql::server
. In another cookbook I want to check if that recipe is applied. Using node.recipe? 'postgresql::server'
I cannot test for that.
How can I do this with Chef?
Upvotes: 0
Views: 2116
Reputation: 21
For completeness:
In principle node.recipe?
is the right way to go.
But in the compile phase of your chef run, node['recipes']
will initially only contain the recipes in your explicitly defined run list.
It will be completed during the compilation phase with every include_recipe
that occurs.
Therefore:
If your node.recipe? 'postgresql::server'
is evaluated before a include_recipe 'postgresql::server'
in the order of compilation, it will return false
.
Upvotes: 0
Reputation: 15784
Try node['recipes'].include? 'postgresql::server'
For what it worth, according to the code , your node.recipe?
should work with latest version.
Upvotes: 4
Reputation: 676
From here: https://docs.chef.io/run_lists.html
knife status --run-list
knife status "role:web" --run-list
Hope this helps.
Thanks, Tim.
Upvotes: -1