diff --git a/lib/puppet/parser/functions/search.rb b/lib/puppet/parser/functions/search.rb index 04c7579d7..8055e38b1 100644 --- a/lib/puppet/parser/functions/search.rb +++ b/lib/puppet/parser/functions/search.rb @@ -1,7 +1,12 @@ Puppet::Parser::Functions::newfunction(:search, :arity => -2, :doc => "Add another namespace for this class to search. This allows you to create classes with sets of definitions and add - those classes to another class's search path.") do |vals| + those classes to another class's search path. + + Deprecated in Puppet 3.7.0, to be removed in Puppet 4.0.0.") do |vals| + + Puppet.deprecation_warning("The 'search' function is deprecated. See http://links.puppetlabs.com/search-function-deprecation") + vals.each do |val| add_namespace(val) end end diff --git a/spec/unit/parser/functions/search_spec.rb b/spec/unit/parser/functions/search_spec.rb index b2c042b04..54054bd6a 100755 --- a/spec/unit/parser/functions/search_spec.rb +++ b/spec/unit/parser/functions/search_spec.rb @@ -1,23 +1,28 @@ #! /usr/bin/env ruby require 'spec_helper' describe "the 'search' function" do before :all do Puppet::Parser::Functions.autoloader.loadall end let :node do Puppet::Node.new('localhost') end let :compiler do Puppet::Parser::Compiler.new(node) end let :scope do Puppet::Parser::Scope.new(compiler) end it "should exist" do Puppet::Parser::Functions.function("search").should == "function_search" end it "should invoke #add_namespace on the scope for all inputs" do scope.expects(:add_namespace).with("where") scope.expects(:add_namespace).with("what") scope.expects(:add_namespace).with("who") scope.function_search(["where", "what", "who"]) end + + it "is deprecated" do + Puppet.expects(:deprecation_warning).with("The 'search' function is deprecated. See http://links.puppetlabs.com/search-function-deprecation") + scope.function_search(['wat']) + end end