Chef node - check if recipe will run on it, looking inside roles as well

南笙酒味 提交于 2019-12-10 14:59:55

问题


I want to find out if a specific recipe will be run on a node from inside a different recipe. I can node.recipe?(recipe_name) method, however some of my recipies are managed by roles and recipe? does not seem to look into the roles run list.

Is there an easy way to find out if my recipie[redis] is going to be run on the current node?


回答1:


You're looking for the recipes method. Note the trailing s! So:

node.recipes.include?(recipe_name)

Also note that there is a similar pair of methods for role inspection. Those are role and roles. For both roles and recipes, the singular form is for those directly assigned and the plural for the fully resolved set.



来源:https://stackoverflow.com/questions/17330553/chef-node-check-if-recipe-will-run-on-it-looking-inside-roles-as-well

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!