Extract the name and version of the cookbook while the chef is working

Please help me with the recipe to get the name and version of the cookbook while the chef-client is running. I want to store values โ€‹โ€‹in variables and use as part of my recipe.

I find it difficult to get the version and name of the cookbook from the recipe while the chef is working on node.

Thanks in advance.

+4
source share
1 answer

You can access the current cookbook name using a variable cookbook_name.

A version of this cookbook (and other cookbooks) can be obtained through run_context:

run_context.cookbook_collection[cookbook_name].version
+7
source

Source: https://habr.com/ru/post/1534794/


All Articles