Skip to content

Instantly share code, notes, and snippets.

@octplane
Created August 11, 2011 12:15
Show Gist options
  • Select an option

  • Save octplane/1139507 to your computer and use it in GitHub Desktop.

Select an option

Save octplane/1139507 to your computer and use it in GitHub Desktop.
First Recipe. Creates the empty monitoring registry and also store the new key
# This recipe should be called at the beginning of the run_list
# If we are not the last item of the run_list break
order = node.recipes
if order[0] != "firstrecipe"
Chef::Log.error("First Recipe should be the first recipe to run; current run list is "+order.inspect)
raise "Please refactor my runlist"
end
# Generate Timestamp for next version of monitored objects
# .to_s because chef is a monkey !
next_key = Time.now.to_i.to_s
node[:monitored] ||= {}
node[:monitored][:content] ||= {}
node[:monitored][:next] = next_key
node[:monitored][:content][next_key] = {}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment