Skip to content

Instantly share code, notes, and snippets.

@ctgswallow
Created October 26, 2012 19:14
Show Gist options
  • Save ctgswallow/3960826 to your computer and use it in GitHub Desktop.
Save ctgswallow/3960826 to your computer and use it in GitHub Desktop.
envs = Hash.new
q = Chef::Search::Query.new
r, f, l = q.search(:node, "fqdn:*.*")
r.each { |n| envs.has_key?(n.chef_environment) ? envs[n.chef_environment] += 1 : envs[n.chef_environment] = 1 }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment