From 3e06d45b8ca670c6cd31d11a14e9708237221c3d Mon Sep 17 00:00:00 2001 From: Thom May Date: Wed, 8 Mar 2017 13:49:24 +0000 Subject: remove partial_search Signed-off-by: Thom May --- lib/chef/search/query.rb | 22 ---------------------- spec/unit/search/query_spec.rb | 18 ------------------ 2 files changed, 40 deletions(-) diff --git a/lib/chef/search/query.rb b/lib/chef/search/query.rb index bea8205935..fb77238ced 100644 --- a/lib/chef/search/query.rb +++ b/lib/chef/search/query.rb @@ -39,28 +39,6 @@ class Chef @rest ||= Chef::ServerAPI.new(@url || @config[:chef_server_url]) end - # Backwards compatability for cookbooks. - # This can be removed in Chef > 12. - def partial_search(type, query = "*:*", *args, &block) - Chef::Log.warn(<<-WARNDEP) -DEPRECATED: The 'partial_search' API is deprecated and will be removed in -future releases. Please use 'search' with a :filter_result argument to get -partial search data. -WARNDEP - - if !args.empty? && args.first.is_a?(Hash) - # partial_search uses :keys instead of :filter_result for - # result filtering. - args_h = args.first.dup - args_h[:filter_result] = args_h[:keys] - args_h.delete(:keys) - - search(type, query, args_h, &block) - else - search(type, query, *args, &block) - end - end - # # New search input, designed to be backwards compatible with the old method signature # 'type' and 'query' are the same as before, args now will accept either a Hash of diff --git a/spec/unit/search/query_spec.rb b/spec/unit/search/query_spec.rb index 51667784fb..6df8587717 100644 --- a/spec/unit/search/query_spec.rb +++ b/spec/unit/search/query_spec.rb @@ -269,22 +269,4 @@ describe Chef::Search::Query do end end - describe "#partial_search" do - include_context "filtered search" do - let(:filter_key) { :keys } - - it "emits a deprecation warning" do - # partial_search calls search, so we'll stub search to return empty - allow(query).to receive(:search).and_return( [ [], 0, 0 ] ) - expect(Chef::Log).to receive(:warn).with(/DEPRECATED: The 'partial_search' API is deprecated/) - query.partial_search(:node, "platform:rhel", args) - end - - it "returns an array of filtered hashes" do - expect(rest).to receive(:post).with(query_string, args[filter_key]).and_return(response) - results = query.partial_search(:node, "platform:rhel", args) - expect(results[0]).to match_array(response_rows) - end - end - end end -- cgit v1.2.1