summaryrefslogtreecommitdiff
path: root/lib/chef/knife
diff options
context:
space:
mode:
authorJeff Blaine <jblaine@kickflop.net>2015-08-27 12:19:47 -0400
committerLamont Granquist <lamont@scriptkiddie.org>2015-10-24 17:57:57 -0700
commit3dee5a59ce524e28bd95d85d9e33c2c41ced8716 (patch)
tree84eb5513929322be90947304e4c1fc06fc79143c /lib/chef/knife
parent8766e4b1012f51ab584f8eb2397ea43d6be92122 (diff)
downloadchef-3dee5a59ce524e28bd95d85d9e33c2c41ced8716.tar.gz
Bring back -H/--hide-healthy for back-compat
Deprecates -H/--hide-healthy instead of removing it.
Diffstat (limited to 'lib/chef/knife')
-rw-r--r--lib/chef/knife/status.rb14
1 files changed, 13 insertions, 1 deletions
diff --git a/lib/chef/knife/status.rb b/lib/chef/knife/status.rb
index e7a9b68ce6..1a61b035cb 100644
--- a/lib/chef/knife/status.rb
+++ b/lib/chef/knife/status.rb
@@ -41,8 +41,12 @@ class Chef
:long => "--sort-reverse",
:description => "Sort the status list by last run time descending"
+ option :hide_healthy,
+ :short => "-H",
+ :long => "--hide-healthy",
+ :description => "Hide nodes that have run chef in the last hour. [DEPRECATED] Use --hide-by-mins MINS instead"
+
option :hide_by_mins,
- :short => "-H MINS",
:long => "--hide-by-mins MINS",
:description => "Hide nodes that have run chef in the last MINS minutes"
@@ -67,6 +71,14 @@ class Chef
append_to_query(@name_args[0]) if @name_args[0]
append_to_query("chef_environment:#{config[:environment]}") if config[:environment]
+ if config[:hide_healthy]
+ ui.warn("-H / --hide-healthy is deprecated. Use --hide-by-mins MINS instead")
+ time = Time.now.to_i
+ # AND NOT is not valid lucene syntax, so don't use append_to_query
+ @query << " " unless @query.empty?
+ @query << "NOT ohai_time:[#{(time - 60*60).to_s} TO #{time.to_s}]"
+ end
+
if config[:hide_by_mins]
hidemins = config[:hide_by_mins].to_i
time = Time.now.to_i