Class: Chef::Knife::RoleStats
- Inherits:
-
Chef::Knife
- Object
- Chef::Knife
- Chef::Knife::RoleStats
- Defined in:
- lib/chef/knife/role_stats.rb
Instance Method Summary collapse
Instance Method Details
#run ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/chef/knife/role_stats.rb', line 17 def run Shef::Extensions.extend_context_object(self) role_names = api.get("/roles").keys role = Hash.new role_names.sort.each do |r| query = "roles:#{r}#{environment_query}" role[r] = search(:node, query).size end puts role.reject! { |k,v| v == 0 }.to_yaml end |