Permalink
Browse files

Merge pull request #2 from aglarond/sorted-nodes

added a sort to the list of nodes to make future comparisons easier
  • Loading branch information...
J.B. Zimmerman
J.B. Zimmerman committed Mar 25, 2013
2 parents 0a5b303 + f4d0110 commit 78a6566ce5c2719865ff0dbd1294b70516dd6641
Showing with 3 additions and 3 deletions.
  1. +3 −3 lib/chef/knife/audit.rb
View
@@ -200,7 +200,7 @@ def format_cookbook_runlist_list_for_display(item)
key_length = item.empty? ? 0 : item.keys.map {|name| name.size }.max + 2
if config[:show_nodelist]
item.sort.map do |name, cookbook|
- "#{name.ljust(key_length)} #{cookbook["count"]} [ #{cookbook["nodes"].join(' ')} ]"
+ "#{name.ljust(key_length)} #{cookbook["count"]} [ #{cookbook["nodes"].sort.join(' ')} ]"
end
else
item.sort.map do |name, cookbook|
@@ -214,7 +214,7 @@ def format_cookbook_seenlist_list_for_display(item)
key_length = item.empty? ? 0 : item.keys.map {|name| name.size }.max + 2
if config[:show_nodelist]
item.sort.map do |name, cookbook|
- "#{name.ljust(key_length)} #{cookbook["seen_recipe_count"]} [ #{cookbook["seen_recipe_nodes"].join(' ')} ]"
+ "#{name.ljust(key_length)} #{cookbook["seen_recipe_count"]} [ #{cookbook["seen_recipe_nodes"].sort.join(' ')} ]"
end
else
item.sort.map do |name, cookbook|
@@ -230,7 +230,7 @@ def format_cookbook_totallist_list_for_display(item)
item.sort.map do |name, cookbook|
cookbook_display = (cookbook["seen_recipe_nodes"] + cookbook["nodes"]).uniq
cookbook_count = cookbook["seen_recipe_count"] + cookbook["count"]
- "#{name.ljust(key_length)} #{cookbook_count} [ #{cookbook_display.join(' ')} ]"
+ "#{name.ljust(key_length)} #{cookbook_count} [ #{cookbook_display.sort.join(' ')} ]"
end
else
item.sort.map do |name, cookbook|

0 comments on commit 78a6566

Please sign in to comment.