Skip to content

Instantly share code, notes, and snippets.

@apinstein
Last active December 16, 2015 08:09
Show Gist options
  • Save apinstein/5404162 to your computer and use it in GitHub Desktop.
Save apinstein/5404162 to your computer and use it in GitHub Desktop.
Using shef (with chef-solo) to debug chef runs
# from inside a "chef-managed" instance (in this case, vagrant)
sudo shef -s -j /tmp/vagrant-chef-1/dna.json -c /tmp/vagrant-chef-1/solo.rb
=> will have nothing in the run list, but all cookbooks loaded.
=> http://stevendanna.github.com/blog/2012/01/28/shef-debugging-tips-1/
# add recipe from source
load_recipe "apache2::mod_fastcgi"
# run chef...
run_chef
# debug/edit code...
# reset run list to "empty"
run_context.resource_collection = Chef::ResourceCollection.new
# re-load recipe and run again...
# rinse & repeat
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment