When working with a Chef Server you often need to know what exactly is already uploaded to it. You edit files like recipes or roles locally, and commit and push them to GitHub.
But, before you're ready to upload your edits to the Chef Server, you want to verify your changes. To do that you want to run a diff between the local version of your files against the version already uploaded to the Chef Server.
If you're using Chef 10.x or 0.10.x you need to install the knife-essentials
gem by adding it to your Gemfile
and running bundle
install.
After changing a recipe, you can diff it against the current version stored on the Chef Server.
Let Knife show you the differences between your local version of my_cookbook
and the version stored on the Chef Server by running:
mma@laptop:~/chef-repo $ knife diff cookbooks/my_cookbook
diff --knife remote/cookbooks/my_cookbook/recipes/default.rbcookbooks/my_cookbook/recipes/default.rb --- remote/cookbooks...