- From: Anthony Goddard <
>
- To:
- Subject: [chef] Checking existence of included recipe
- Date: Wed, 11 Apr 2012 12:00:58 -0400
Hi chefs,
We had some discussion on IRC about this a few days ago, thought I might
throw my thoughts to the list.
I have two recipes which include the rabbitmq::server recipe (sensu::rabbitmq
and logstash::broker [1][2]), and a bunch of nodes which have rabbitmq-server
installed by these. I have a new cookbook which needs to check whether the
rabbitmq::server recipe was run on the node, ordinarily I could do `if
node[:recipes].include?("rabbitmq::default")` but in this case,
rabbitmq::default isn't in the node's recipes because it's installed by the
include statement in the sensu/logstash recipes.
jtimberman helpfully pointed out that node.run_state[:seen_recipes] will be
populated with all of the recipes as the run progresses, though in order for
this to work, I'd have to make sure the cookbook with the dependency is run
at the end of the run. Am I missing a really obvious way of doing this
dependency check for a recipe that's included with `include_recipe`?
Cheers,
Ant
[1]
https://github.com/agoddard/sensu-cookbooks/blob/master/sensu/recipes/rabbitmq.rb
[2]
https://github.com/agoddard/logstash-cookbook/blob/master/recipes/broker.rb
---
Anthony Goddard
Woods Hole Marine Biological Laboratory
- [chef] Checking existence of included recipe, Anthony Goddard, 04/11/2012
Archive powered by MHonArc 2.6.16.