diff options
author | Thom May <thom@may.lt> | 2015-03-16 11:09:52 +0000 |
---|---|---|
committer | Thom May <thom@may.lt> | 2015-03-16 11:09:52 +0000 |
commit | a0872d16eda17b7fb144513425a2a4af2bc8c369 (patch) | |
tree | 968b87c94a7d648b605203bb2dc5adfcb41bd07f /lib/chef/knife | |
parent | 0d7f6a64abef06e94273dbcefd8adc53ab071f11 (diff) | |
download | chef-a0872d16eda17b7fb144513425a2a4af2bc8c369.tar.gz |
Ensure valid lucene queries
Diffstat (limited to 'lib/chef/knife')
-rw-r--r-- | lib/chef/knife/status.rb | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/chef/knife/status.rb b/lib/chef/knife/status.rb index 93e596a7db..be48b87368 100644 --- a/lib/chef/knife/status.rb +++ b/lib/chef/knife/status.rb @@ -52,13 +52,15 @@ class Chef def run ui.use_presenter Knife::Core::StatusPresenter - @query = "" + @query ||= "" append_to_query(@name_args[0]) if @name_args[0] append_to_query("chef_environment:#{config[:environment]}") if config[:environment] if config[:hide_healthy] time = Time.now.to_i - append_to_query("NOT ohai_time:[#{(time - 60*60).to_s} TO #{time.to_s}]") + # 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 @query = @query.empty? ? "*:*" : @query |