]> gitweb.fluxo.info Git - puppet-stdlib.git/commit
(MODULES-707) chomp() fails because generate() no longer returns a string
authorMark Chappell <mchappel@redhat.com>
Tue, 22 Apr 2014 07:36:28 +0000 (09:36 +0200)
committerMark Chappell <mchappel@redhat.com>
Mon, 22 Sep 2014 17:49:50 +0000 (19:49 +0200)
commite2d7f3bb89a91d3aff6f9810d69bd84bc82ffb29
treee98f261a7fdafde7d4612f0770e20bbb832bf4a6
parentb347cc83e24e7ef51dc340bc753b96af026050f8
(MODULES-707) chomp() fails because generate() no longer returns a string

We need to use

  unless value.is_a?(String) || value.is_a?(Array)

rather than

  klass = value.class
  unless [String, Array].include?(klass)

because the klass version enforces type checking which is too strict, and does
not allow us to accept objects wich have extended String (or Array).

For example, generate() function now returns Puppet::Util::Execution::ProcessOutput
which is just a very simple extension of String.  While this in it's self was
not intentional (PUP-2306) it is not unreasonable to cope with objects which
extend Strings
34 files changed:
lib/puppet/parser/functions/bool2num.rb
lib/puppet/parser/functions/capitalize.rb
lib/puppet/parser/functions/chomp.rb
lib/puppet/parser/functions/chop.rb
lib/puppet/parser/functions/downcase.rb
lib/puppet/parser/functions/empty.rb
lib/puppet/parser/functions/fqdn_rotate.rb
lib/puppet/parser/functions/lstrip.rb
lib/puppet/parser/functions/reverse.rb
lib/puppet/parser/functions/rstrip.rb
lib/puppet/parser/functions/shuffle.rb
lib/puppet/parser/functions/strip.rb
lib/puppet/parser/functions/swapcase.rb
lib/puppet/parser/functions/unique.rb
lib/puppet/parser/functions/upcase.rb
lib/puppet/parser/functions/uriescape.rb
lib/puppet/parser/functions/zip.rb
spec/functions/bool2num_spec.rb
spec/functions/capitalize_spec.rb
spec/functions/chomp_spec.rb
spec/functions/chop_spec.rb
spec/functions/downcase_spec.rb
spec/functions/empty_spec.rb
spec/functions/fqdn_rotate_spec.rb
spec/functions/lstrip_spec.rb
spec/functions/reverse_spec.rb
spec/functions/rstrip_spec.rb
spec/functions/shuffle_spec.rb
spec/functions/strip_spec.rb
spec/functions/swapcase_spec.rb
spec/functions/unique_spec.rb
spec/functions/upcase_spec.rb
spec/functions/uriescape_spec.rb
spec/functions/zip_spec.rb