Update stdlib and concat to 6.1.0 both
[mirror/dsa-puppet.git] / 3rdparty / modules / stdlib / lib / puppet / parser / functions / deprecation.rb
1 #
2 # deprecation.rb
3 #
4 module Puppet::Parser::Functions
5   newfunction(:deprecation, :doc => <<-DOC
6   @summary
7     Function to print deprecation warnings (this is the 3.X version of it).
8
9   The uniqueness key - can appear once. The msg is the message text including any positional
10   information that is formatted by the user/caller of the method.).
11
12   @return [String]
13     return deprecation warnings
14 DOC
15              ) do |arguments|
16
17     raise(Puppet::ParseError, "deprecation: Wrong number of arguments given (#{arguments.size} for 2)") unless arguments.size == 2
18
19     key = arguments[0]
20     message = arguments[1]
21
22     if ENV['STDLIB_LOG_DEPRECATIONS'] == 'true'
23       warning("deprecation. #{key}. #{message}")
24     end
25   end
26 end