Skip to content

Instantly share code, notes, and snippets.

@adamhjk
Created June 8, 2011 17:08
Show Gist options
  • Save adamhjk/1014841 to your computer and use it in GitHub Desktop.
Save adamhjk/1014841 to your computer and use it in GitHub Desktop.
keep_last_run_list.rb
# This should be in a recipe, as early in the run list as possible
begin
node.override[:previous_run_list] = JSON.parse(Chef::FileCache.load("previous_run_list"))
rescue Chef::Exceptions::FileNotFound
Chef::Log.debug("No stored run list!")
end
Chef::FileCache.store("previous_run_list", node.run_list.to_json)
# When you want to check if the last run list had the previous role...
if node.previous_run_list.include?("role[master]")
...
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment