Inspecting the results of your last Chef run

When developing new cookbooks, we need to know what exactly went wrong when a Chef client run fails.

Even though Chef prints all the details to stdout, you might want to look at it again, for example, after clearing your shell window.

Getting ready

You need to have a broken cookbook in your node's run list; any invalid piece of Ruby code will do:

Nil.each {}

How to do it...

Carry out the following steps:

  1. Run the Chef client with your broken cookbook:
    user@server:~$ sudo chef-client
    ================================================================================
    Recipe Compile Error in /var/chef/cache/cookbooks/my_cookbook/recipes/default.rb
    ================================================================================ ...

Get Chef Cookbook - Third Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.