diff options
author | Pete Higgins <pete@peterhiggins.org> | 2020-12-28 15:47:20 -0800 |
---|---|---|
committer | Tim Smith <tsmith84@gmail.com> | 2020-12-30 11:43:11 -0800 |
commit | c314d64c0d28bc8d950032b113cc0bbc85b32fcd (patch) | |
tree | f4d54a379090289406253ad487104cd2f29b9573 | |
parent | 876b6bbdbcaae6cf2e51998709abb03acb8de6c2 (diff) | |
download | chef-c314d64c0d28bc8d950032b113cc0bbc85b32fcd.tar.gz |
Untangle some gnarly code.
Signed-off-by: Pete Higgins <pete@peterhiggins.org>
-rw-r--r-- | lib/chef/knife/status.rb | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/lib/chef/knife/status.rb b/lib/chef/knife/status.rb index 6cce1b9d32..b70c61773a 100644 --- a/lib/chef/knife/status.rb +++ b/lib/chef/knife/status.rb @@ -84,13 +84,10 @@ class Chef all_nodes << node end - output(all_nodes.sort do |n1, n2| - if config[:sort_reverse] || config[:sort_status_reverse] - (n2["ohai_time"] || 0) <=> (n1["ohai_time"] || 0) - else - (n1["ohai_time"] || 0) <=> (n2["ohai_time"] || 0) - end - end) + all_nodes.sort_by! {|n| n["ohai_time"] || 0 } + all_nodes.reverse! if config[:sort_reverse] || config[:sort_status_reverse] + + output(all_nodes) end end |