try something like this,check for syntax . i havent run this :-)On Mon, May 6, 2013 at 3:43 PM, DV < " target="_blank"> > wrote:
Hey all,So I've been trying to write a script which will show me which cookbooks are used in an environment that are not version-locked.I thought I have it all figured out, with the following command fetching a list of cookbooks used in an environment. It collects "recipes" attribute of all nodes in the environment and extracts cookbook names:knife search node "chef_environment:${CHEF_ENVIRONMENT}" -a recipes| grep -v -e ^id -e ^recipes -e found$ -e ^$ | awk -F':' '{print $1}' | sed 's/^ *//; s/; */;/g' |sort|uniq
The command does its job, but it has a major downside: it doesn't list cookbooks that are not explicitly listed in the "recipes" attribute. So, for example, if "tomcat" cookbook calls "java" cookbook, and "tomcat" cookbook is assigned to some node in the environment, the command above will list "tomcat" but not "java".Is there a better way to fetch a list of cookbooks? Or should I add logic to resolve cookbook dependencies? Thanks.--
Best regards, Dmitriy V.
Archive powered by MHonArc 2.6.16.