Issue #1895 has been reported by pietro_ferrari.

----------------------------------------
Bug #1895: Puppet is passing incorrect values to functions
http://projects.reductivelabs.com/issues/1895

Author: pietro_ferrari
Status: Unreviewed
Priority: Normal
Assigned to: 
Category: 
Target version: 
Complexity: Unknown
Affected version: 0.24.7
Keywords: 


I'm trying to pass an Array as argument to a function, but it fails. I created 
a simple module to test it. Code follows:

Functions:
<pre>
# return true case var is an array, false otherwise.
Puppet::Parser::Functions::newfunction(:is_array, :type => :rvalue) do |vals|
        if vals[0].is_a?(Array)
                "true"
        else
                "false"
        end
end
# simple split
Puppet::Parser::Functions::newfunction(:simple_split, :type => :rvalue) do 
|vals|
        vals[0].split(/#{vals[1]}/)
end
</pre>

My class:
<pre>
class testing {
  $a_string = "foo bar baz quux"
  $should_be_an_array = simple_split($a_string, " ")
  $should_be_true = is_array($should_be_an_array)

  file {
    "/tmp/true_test":
      content => $should_be_true,
      mode => 0666, owner => root, group => root;
  }
}
</pre>

/tmp/true_test gets correctly set to true when running puppet/puppetmaster 
0.24.5 (Debian package 0.24.5-3) and incorrectly set to false when running 
puppet/puppetmaster 0.24.7 (Debian package 0.24.7-1).


----------------------------------------
You have received this notification because you have either subscribed to it, 
or are involved in it.
To change your notification preferences, please click here: 
http://reductivelabs.com/redmine/my/account

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Puppet Bugs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/puppet-bugs?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to