diff options
author | tphoney <tp@puppet.com> | 2016-08-08 17:35:13 +0100 |
---|---|---|
committer | tphoney <tp@puppet.com> | 2016-08-08 17:46:11 +0100 |
commit | 22fbe723acd22ae3491c41beeacbc76853c6820e (patch) | |
tree | c91448e5face966d92d713b537316adcd08fbac3 /lib | |
parent | e39fe01ea01719b97110341cacc4b4e2784a7d1a (diff) |
(modules-3532) deprecate string type checks
Diffstat (limited to 'lib')
-rw-r--r-- | lib/puppet/parser/functions/is_absolute_path.rb | 4 | ||||
-rw-r--r-- | lib/puppet/parser/functions/is_array.rb | 4 | ||||
-rw-r--r-- | lib/puppet/parser/functions/is_bool.rb | 4 | ||||
-rw-r--r-- | lib/puppet/parser/functions/is_string.rb | 2 | ||||
-rw-r--r-- | lib/puppet/parser/functions/validate_absolute_path.rb | 2 | ||||
-rw-r--r-- | lib/puppet/parser/functions/validate_array.rb | 2 | ||||
-rw-r--r-- | lib/puppet/parser/functions/validate_bool.rb | 2 | ||||
-rw-r--r-- | lib/puppet/parser/functions/validate_re.rb | 3 | ||||
-rw-r--r-- | lib/puppet/parser/functions/validate_string.rb | 2 |
9 files changed, 19 insertions, 6 deletions
diff --git a/lib/puppet/parser/functions/is_absolute_path.rb b/lib/puppet/parser/functions/is_absolute_path.rb index 53a5445..2e37414 100644 --- a/lib/puppet/parser/functions/is_absolute_path.rb +++ b/lib/puppet/parser/functions/is_absolute_path.rb @@ -23,7 +23,7 @@ module Puppet::Parser::Functions is_absolute_path($undefined) ENDHEREDOC - + function_deprecation([:puppet_3_type_check, 'This method is deprecated, please use the stdlib validate_legacy function, with Stdlib::Compat::Absolute_path. There is further documentation for validate_legacy function in the README.']) require 'puppet/util' path = args[0] @@ -47,4 +47,4 @@ module Puppet::Parser::Functions end value end -end
\ No newline at end of file +end diff --git a/lib/puppet/parser/functions/is_array.rb b/lib/puppet/parser/functions/is_array.rb index b39e184..d1bb58a 100644 --- a/lib/puppet/parser/functions/is_array.rb +++ b/lib/puppet/parser/functions/is_array.rb @@ -8,6 +8,8 @@ Returns true if the variable passed to this function is an array. EOS ) do |arguments| + function_deprecation([:puppet_3_type_check, 'This method is deprecated, please use the stdlib validate_legacy function, with Stdlib::Compat::Array. There is further documentation for validate_legacy function in the README.']) + raise(Puppet::ParseError, "is_array(): Wrong number of arguments " + "given (#{arguments.size} for 1)") if arguments.size < 1 @@ -18,5 +20,3 @@ Returns true if the variable passed to this function is an array. return result end end - -# vim: set ts=2 sw=2 et : diff --git a/lib/puppet/parser/functions/is_bool.rb b/lib/puppet/parser/functions/is_bool.rb index 8bbdbc8..48aaa08 100644 --- a/lib/puppet/parser/functions/is_bool.rb +++ b/lib/puppet/parser/functions/is_bool.rb @@ -8,6 +8,8 @@ Returns true if the variable passed to this function is a boolean. EOS ) do |arguments| + function_deprecation([:puppet_3_type_check, 'This method is deprecated, please use the stdlib validate_legacy function, with Stdlib::Compat::Bool. There is further documentation for validate_legacy function in the README.']) + raise(Puppet::ParseError, "is_bool(): Wrong number of arguments " + "given (#{arguments.size} for 1)") if arguments.size != 1 @@ -18,5 +20,3 @@ Returns true if the variable passed to this function is a boolean. return result end end - -# vim: set ts=2 sw=2 et : diff --git a/lib/puppet/parser/functions/is_string.rb b/lib/puppet/parser/functions/is_string.rb index f5bef04..144cf51 100644 --- a/lib/puppet/parser/functions/is_string.rb +++ b/lib/puppet/parser/functions/is_string.rb @@ -8,6 +8,8 @@ Returns true if the variable passed to this function is a string. EOS ) do |arguments| + function_deprecation([:puppet_3_type_check, 'This method is deprecated, please use the stdlib validate_legacy function, with Stdlib::Compat::String. There is further documentation for validate_legacy function in the README.']) + raise(Puppet::ParseError, "is_string(): Wrong number of arguments " + "given (#{arguments.size} for 1)") if arguments.size < 1 diff --git a/lib/puppet/parser/functions/validate_absolute_path.rb b/lib/puppet/parser/functions/validate_absolute_path.rb index 5f85f72..d5f5443 100644 --- a/lib/puppet/parser/functions/validate_absolute_path.rb +++ b/lib/puppet/parser/functions/validate_absolute_path.rb @@ -26,6 +26,8 @@ module Puppet::Parser::Functions ENDHEREDOC + function_deprecation([:puppet_3_type_check, 'This method is deprecated, please use the stdlib validate_legacy function, with Stdlib::Compat::Absolute_path. There is further documentation for validate_legacy function in the README.']) + require 'puppet/util' unless args.length > 0 then diff --git a/lib/puppet/parser/functions/validate_array.rb b/lib/puppet/parser/functions/validate_array.rb index 34b5118..97bd41d 100644 --- a/lib/puppet/parser/functions/validate_array.rb +++ b/lib/puppet/parser/functions/validate_array.rb @@ -18,6 +18,8 @@ module Puppet::Parser::Functions ENDHEREDOC + function_deprecation([:puppet_3_type_check, 'This method is deprecated, please use the stdlib validate_legacy function, with Stdlib::Compat::Array. There is further documentation for validate_legacy function in the README.']) + unless args.length > 0 then raise Puppet::ParseError, ("validate_array(): wrong number of arguments (#{args.length}; must be > 0)") end diff --git a/lib/puppet/parser/functions/validate_bool.rb b/lib/puppet/parser/functions/validate_bool.rb index 59a0805..4e52ffd 100644 --- a/lib/puppet/parser/functions/validate_bool.rb +++ b/lib/puppet/parser/functions/validate_bool.rb @@ -19,6 +19,8 @@ module Puppet::Parser::Functions ENDHEREDOC + function_deprecation([:puppet_3_type_check, 'This method is deprecated, please use the stdlib validate_legacy function, with Stdlib::Compat::Bool. There is further documentation for validate_legacy function in the README.']) + unless args.length > 0 then raise Puppet::ParseError, ("validate_bool(): wrong number of arguments (#{args.length}; must be > 0)") end diff --git a/lib/puppet/parser/functions/validate_re.rb b/lib/puppet/parser/functions/validate_re.rb index efee7f8..6bdc858 100644 --- a/lib/puppet/parser/functions/validate_re.rb +++ b/lib/puppet/parser/functions/validate_re.rb @@ -29,6 +29,9 @@ module Puppet::Parser::Functions validate_re("${::operatingsystemmajrelease}", '^[57]$') ENDHEREDOC + + function_deprecation([:puppet_3_type_check, 'This method is deprecated, please use the stdlib validate_legacy function, with Stdlib::Compat::Re. There is further documentation for validate_legacy function in the README.']) + if (args.length < 2) or (args.length > 3) then raise Puppet::ParseError, "validate_re(): wrong number of arguments (#{args.length}; must be 2 or 3)" end diff --git a/lib/puppet/parser/functions/validate_string.rb b/lib/puppet/parser/functions/validate_string.rb index c841f6a..e92a2fc 100644 --- a/lib/puppet/parser/functions/validate_string.rb +++ b/lib/puppet/parser/functions/validate_string.rb @@ -23,6 +23,8 @@ module Puppet::Parser::Functions ENDHEREDOC + function_deprecation([:puppet_3_type_check, 'This method is deprecated, please use the stdlib validate_legacy function, with Stdlib::Compat::String. There is further documentation for validate_legacy function in the README.']) + unless args.length > 0 then raise Puppet::ParseError, ("validate_string(): wrong number of arguments (#{args.length}; must be > 0)") end |