skip to Main Content

Env:

chef-client --version
Chef: 14.3.37

Description:

Chef-client was run via following command

chef-client -c <file.rb> -j <file.json> -E <env> 2>&1 > file.log

After executing file.log contains following line about list of resolved cookbooks for current run:

[time] INFO: Loading cookbooks [[email protected], [email protected], [email protected], [email protected], [email protected]]

Question:

Via which command for chef-client (not knife!) I could extract such list of cookbooks with versions?

PS:

Parsing of logs is not great idea is firts.
There is no way to configure knife – second.

2

Answers


  1. if you wish to access the expended recipe run-list, use node['recipes'].

    if you are interested in the node’s roles, use node['roles']

    note that these are node attributes, which means that you can access them same as you access any other node attribute.

    Login or Signup to reply.
  2. I would suggest to write a recipe, that saves all the required information into some file in required format, and include this recipe into run list. Then every time Chef-client is run, it will update the file.

    As Mr. pointed out, the expanded run-list can be taken from the node[‘recipes’] attributes, so it’s very easy to extract the required info.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search