diff options
author | TP Honey <tphoney@users.noreply.github.com> | 2015-09-09 11:20:18 +0100 |
---|---|---|
committer | TP Honey <tphoney@users.noreply.github.com> | 2015-09-09 11:20:18 +0100 |
commit | 2a7a93ffb49b2ae63d4fd09982fd8c382c1f4b5a (patch) | |
tree | 772579a612c2df74e96b82a6588673da55cf34c2 /lib | |
parent | 00b11c20c87c028d2206e444c321a8b43d7aa52b (diff) | |
parent | f2f2db4795fc0e3b9387e1e6c003e8e75efde903 (diff) | |
download | puppet-stdlib-2a7a93ffb49b2ae63d4fd09982fd8c382c1f4b5a.tar.gz puppet-stdlib-2a7a93ffb49b2ae63d4fd09982fd8c382c1f4b5a.tar.bz2 |
Merge pull request #518 from logicminds/case_insensitive
accept any case of boolean strings
Diffstat (limited to 'lib')
-rw-r--r-- | lib/puppet/parser/functions/str2bool.rb | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/lib/puppet/parser/functions/str2bool.rb b/lib/puppet/parser/functions/str2bool.rb index 446732e..8def131 100644 --- a/lib/puppet/parser/functions/str2bool.rb +++ b/lib/puppet/parser/functions/str2bool.rb @@ -5,8 +5,8 @@ module Puppet::Parser::Functions newfunction(:str2bool, :type => :rvalue, :doc => <<-EOS This converts a string to a boolean. This attempt to convert strings that -contain things like: y, 1, t, true to 'true' and strings that contain things -like: 0, f, n, false, no to 'false'. +contain things like: Y,y, 1, T,t, TRUE,true to 'true' and strings that contain things +like: 0, F,f, N,n, false, FALSE, no to 'false'. EOS ) do |arguments| @@ -32,8 +32,8 @@ like: 0, f, n, false, no to 'false'. # We yield false in this case. # when /^$/, '' then false # Empty string will be false ... - when /^(1|t|y|true|yes)$/ then true - when /^(0|f|n|false|no)$/ then false + when /^(1|t|y|true|yes)$/i then true + when /^(0|f|n|false|no)$/i then false when /^(undef|undefined)$/ then false # This is not likely to happen ... else raise(Puppet::ParseError, 'str2bool(): Unknown type of boolean given') |