Bug #1895
Puppet is passing incorrect values to functions
| Status: | Closed | Start date: | 01/26/2009 | |
|---|---|---|---|---|
| Priority: | Normal | Due date: | ||
| Assignee: | - | % Done: | 0% |
|
| Category: | - | |||
| Target version: | - | |||
| Affected Puppet version: | 0.24.7 | Branch: | ||
| Keywords: | ||||
| Votes: | 0 |
Description
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:
# 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
My class:
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;
}
}
/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).
History
Updated by Udo Waechter over 3 years ago
I think this is a duplicate of #1824
Updated by Pietro Ferrari over 3 years ago
- Status changed from Unreviewed to Closed