[chef] Re: search if a recipe is part of the run-list, including all indirectly included recipes


Chronological Thread 
  • From: Peter Donald < >
  • To: " " < >
  • Subject: [chef] Re: search if a recipe is part of the run-list, including all indirectly included recipes
  • Date: Wed, 29 May 2013 07:34:52 +1000

Hi,

I don't have the link with me but the knife-audit plugin includes a snippet that adds the full set of "seen" recipes as a node attribute. This what we use to record the recipes run. Also I would highly recommend that you do NOT record the recipes in normal precedence as they will persist between runs

On Wednesday, May 29, 2013, Koert Kuipers wrote:
ah okay thanks! that is what i am currently doing. i was wondering if there was a better way


On Tue, May 28, 2013 at 5:21 PM, Sean OMeara < ');" target="_blank"> > wrote:
Currently, recipes included via the "include_recipe" directive leave no "evidence" they were included in the node object unless they were specifically written to. 

As a quick work around, you can put this on the droids you're looking for:

node.set['cookbook_name']['recipe_name']['beacon'] = true

-s


On Tue, May 28, 2013 at 5:16 PM, Koert Kuipers < ');" target="_blank"> > wrote:
i tried this and it expands roles but not recipes.

so if recipe y is in the run-list and recipe y has a 'include_recipe "x"', then search(:node,"recipes:x") does not work


On Tue, May 28, 2013 at 5:14 PM, Ranjib Dey < ');" target="_blank"> > wrote:
search(:node,"recipes:foo")

note. the attribute `recipes` (against which we are searching here) is populated as per the run list expansion process and stored in the chef server after a successful chef run. Which means it will not include a node(including the self node) that has not gone through at least 1 successful chef run.

regards
ranjib



On Tue, May 28, 2013 at 2:10 PM, Koert Kuipers < ');" target="_blank"> > wrote:
how can i search if a node ran recipe "x" in it's last chef-run? i don't care if "x" was directly in the run-list, part of a role that was part of the run-list, or if it was included in another recipe in the run-list (so a include_recipe "x" somewhere)






--
Cheers,

Peter Donald



Archive powered by MHonArc 2.6.16.

§