Chef 0.7.12rc0, Ohai 0.3.4rc0 release(s)

It’s that time again! I’m pleased to announce the release candidates of Chef 0.7.12 and Ohai 0.3.4.

I hope you’ll take the time to test both releases on a development snapshot of any production infrastructure, and report bugs towards the 0.7.12 and 0.3.4 projects on JIRA. I’ve tentatively scheduled the release of 0.7.12 and 0.3.4 final for later this week.


The MVP for this release is Diego Algorta; he has supplied us with the ability for Ohai to detect (CHEF-293) the correct locale for every Linux system, and use this information while parsing system commands used internally in Chef. This fix restores the ability for Chef and Ohai to be used on systems where a non-English installation was selected.

We’ve had a staggering number of contributions this cycle and considerably increased our speed and stability. New features worth noting are the completion of Lightweight Resources and Providers, and the Deploy and SCM resources.


Wiki Documentation Page

Lightweight Resources and Providers allow the seasoned cookbook author to build standard Chef resources and providers via a lightweight cookbook based DSL. Cookbooks gain two new optional directories for this feature, ‘resources/’ and ‘providers/’. We’re expecting the emergence of lightweight resources and providers to almost entirely replace the usage of definitions, which are used currently throughout cookbooks as global macros.

Cookbook Layout


This will build the following resources and providers:


Without reproducing too much from the existing documentation, a few examples:


actions :print_message, :touch_file

attribute :message, :kind_of => String
attribute :filename, :kind_of => String


action :print_message do
  puts new_resource.message

action :touch_file do
  file "#{node[:tmpdir]}/#{new_resource.filename}" do
    action :create


lwrp "foo" do
  message "Default everything"
  action :print_message

  provider Chef::Provider::Lwrp

lwrp "bar" do
  filename "/tmp/foo"
  action :touch_file

  provider Chef::Provider::Lwrp

Deploy / SCM Resources

Wiki Documentation Page

The chef-deploy project written originally by Ezra Zygmuntowicz to bring Capistrano-strategy deployment to Chef has been ported to Chef proper. The SCM functionality has additionally been extracted into Git and Subversion resources. I’m increasingly excited with the prospects opened by having deployment and SCM functionality available as first class citizens in Chef, and hope we can continue to offer more enhancements such as alternate (cough Heroku) deploy strategies.

I believe a few examples will speak for themselves:

CouchDB from SCM?

subversion "CouchDB Edge" do
  repository ""
  revision "HEAD"
  destination "/opt/mysources/couch"
  action :sync

Prefer git?

git "/opt/mysources/couch" do
  repository "git://"
  reference "HEAD"
  action :sync

Fancy deploying a rails app with a custom application layout and in-line Chef resource deployment hooks? No problem!

deploy "#{node[:tmpdir]}/deploy" do
  repo "#{node[:tmpdir]}/gitrepo/typo/"
  environment "RAILS_ENV" => "production"
  revision "HEAD"
  action :deploy
  migration_command "rake db:migrate --trace"
  migrate true
  symlinks  "system" => "public/system", "pids" => "tmp/pids", "log" => "log"

  # Callbacks
  before_migrate do
    current_release = release_path
    directory "#{current_release}/deploy" do
      mode "0755"
    # creates a callback for before_symlink
    template "#{current_release}/deploy/before_symlink_callback.rb" do
      source "embedded_recipe_before_symlink.rb.erb"
      mode "0644"
  # This file can contain Chef recipe code, plain ruby also works
  before_symlink "deploy/before_symlink_callback.rb"
  restart do
    current_release = release_path
    file "#{release_path}/tmp/restart.txt" do
      mode "0644"

Release Notes – Chef – Version 0.7.12rc0


  • [CHEF-293] – Chef breaks on systems with non-English Locales
  • [CHEF-501] – Fails to follow notification chains
  • [CHEF-534] – remove execute permissions from javascripts, images, etc.
  • [CHEF-544] – Service provider fails to set @new_resource.updated
  • [CHEF-562] – typo in provider/ifconfig.rb
  • [CHEF-569] – Remote File causes updates to be sent regardless of idempotency
  • [CHEF-578] – Lots of files/subdirectories in a remote_directory cause most chef requests to take 11.5 seconds, and the merb process goes up to 100% CPU


  • [CHEF-503] – cookbooks UI should display the relative path of the template
  • [CHEF-546] – Make couchdb version switcher 0.8 specific, and use the new format for everything else.
  • [CHEF-559] – distro/ should be under ‘chef’ dir and packaged w/ gem.
  • [CHEF-560] – refactor Chef::Provider::Group::Groupadd
  • [CHEF-561] – Flexible application layouts for deploy resource and provider
  • [CHEF-566] – Deploy resource/provider callbacks for before_migrate, &etc. should support in-line recipes
  • [CHEF-568] – Increase logging for Remote File status, including checksummation.
  • [CHEF-580] – faster find_preferred_file
  • [CHEF-582] – group resource should allow users or members as a parameter

New Feature

  • [CHEF-145] – Cron resource: add support for setting cron environment variables like MAILTO or PATH
  • [CHEF-419] – Create SCM resource and providers for git & svn
  • [CHEF-496] – add simple service provider to chef


Release Notes – Ohai – Version 0.3.4rc0


  • [OHAI-107] – EC2 spec tests fails when not connected to network
  • [OHAI-111] – ec2 userdata gets truncated
  • [OHAI-112] – when installed on ubuntu/debian packages w/o rubygems, ohai fails with a type error
  • [OHAI-122] – ohai on opensolaris 11 doesn’t properly detect os for plugins
  • [OHAI-125] – fqdn not set on solaris


  • [OHAI-95] – Support multiple JSON libraries
  • [OHAI-116] – Redhat platform version should include the subrelease
  • [OHAI-120] – refactor ohai to use Mixlib
  • [OHAI-129] – Ohai on Solaris should produce gloriously verbose output about kernel modules

New Feature

AJ Christensen