From 448e66b8bb3bd5a2b413436b21c2c480511223c8 Mon Sep 17 00:00:00 2001 From: Alexander Pánek Date: Tue, 16 Sep 2014 17:55:26 +0200 Subject: Updated docs of validate_string to reflect bug See: https://tickets.puppetlabs.com/browse/MODULES-457 --- lib/puppet/parser/functions/validate_string.rb | 3 +++ 1 file changed, 3 insertions(+) (limited to 'lib') diff --git a/lib/puppet/parser/functions/validate_string.rb b/lib/puppet/parser/functions/validate_string.rb index e667794..0bab21e 100644 --- a/lib/puppet/parser/functions/validate_string.rb +++ b/lib/puppet/parser/functions/validate_string.rb @@ -13,6 +13,9 @@ module Puppet::Parser::Functions validate_string(true) validate_string([ 'some', 'array' ]) + + NOTE: undef will only fail when using the future parser (See: https://tickets.puppetlabs.com/browse/MODULES-457) + $undefined = undef validate_string($undefined) -- cgit v1.2.3 From 6631934df8775305bc6c92514b5dec3624f5ba4d Mon Sep 17 00:00:00 2001 From: Alexander Pánek Date: Tue, 16 Sep 2014 19:03:02 +0200 Subject: Note that also future parser does not work --- lib/puppet/parser/functions/validate_string.rb | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'lib') diff --git a/lib/puppet/parser/functions/validate_string.rb b/lib/puppet/parser/functions/validate_string.rb index 0bab21e..c841f6a 100644 --- a/lib/puppet/parser/functions/validate_string.rb +++ b/lib/puppet/parser/functions/validate_string.rb @@ -14,11 +14,13 @@ module Puppet::Parser::Functions validate_string(true) validate_string([ 'some', 'array' ]) - NOTE: undef will only fail when using the future parser (See: https://tickets.puppetlabs.com/browse/MODULES-457) + Note: validate_string(undef) will not fail in this version of the + functions API (incl. current and future parser). Instead, use: + + if $var == undef { + fail('...') + } - $undefined = undef - validate_string($undefined) - ENDHEREDOC unless args.length > 0 then -- cgit v1.2.3