source: other-projects/hathitrust/vagrant-solr-cluster/trunk/modules/stdlib/lib/puppet/functions/deprecation.rb@ 30960

Last change on this file since 30960 was 30960, checked in by davidb, 8 years ago

Switch to using Puppet to provision machine. Strongly based on files developed for spark-hdfs cluster

File size: 940 bytes
Line 
1# Function to print deprecation warnings, Logs a warning once for a given key. The uniqueness key - can appear once. The msg is the message text including any positional information that is formatted by the user/caller of the method It is affected by the puppet setting 'strict', which can be set to :error (outputs as an error message), :off (no message / error is displayed) and :warning (default, outputs a warning) *Type*: String, String.
2#
3
4Puppet::Functions.create_function(:deprecation) do
5 dispatch :deprecation do
6 param 'String', :key
7 param 'String', :message
8 end
9
10 def deprecation(key, message)
11 # depending on configuration setting of strict
12 case Puppet.settings[:strict]
13 when :off
14 # do nothing
15 when :error
16 fail("deprecation. #{key}. #{message}")
17 else
18 unless ENV['STDLIB_LOG_DEPRECATIONS'] == 'false'
19 Puppet.deprecation_warning(message, key)
20 end
21 end
22 end
23end
Note: See TracBrowser for help on using the repository browser.