Class: Chef::Knife::EnvironmentStats

Inherits:
Chef::Knife show all
Defined in:
lib/chef/knife/environment_stats.rb

Instance Method Summary collapse

Instance Method Details

#runObject



13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/chef/knife/environment_stats.rb', line 13

def run
  Shef::Extensions.extend_context_object(self)
  
  environment_names = api.get("/environments").keys
  
  environment = Hash.new
  environment_names.sort.each do |env|
    environment[env] = search(:node, "chef_environment:#{env}").size
  end
  
  puts environment.to_yaml
end