Issue #21026 has been reported by Szymon Stupkiewicz.
----------------------------------------
Bug #21026: Passing boolean variables from hiera trough parameterized classes
doesn't work as expected
https://projects.puppetlabs.com/issues/21026
* Author: Szymon Stupkiewicz
* Status: Unreviewed
* Priority: High
* Assignee:
* Category:
* Target version:
* Affected Puppet version: 3.1.1
* Keywords:
* Branch:
----------------------------------------
Passing of boolean variables from hiera trough parameterized class to template
doesn't work as expected. Sample code:
modules/testing/manifests/test.pp:
class testing::test(
$foo = false,
$bar = true,
) {
file { '/tmp/foo.txt':
content => template('testing/test.erb')
}
}
modules/testing/templates/test.erb:
# This is sample file:
<% if foo -%>
# some content if foo is true
<% end -%>
<% if bar -%>
# content if bar is true
<% end -%>
# foo value: <%= foo %>
# bar value: <%= bar %>
# same for hiera variable:
<% if scope.function_hiera(['testing::test::foo']) %>
# some content if foo is true
<% end -%>
<% if scope.function_hiera(['testing::test::bar']) %>
# some content if bar is true
<% end -%>
# foo value from hiera: <%= scope.function_hiera(['testing::test::foo']) %>
# bar value from hiera: <%= scope.function_hiera(['testing::test::bar']) %>
Hiera data for above example:
---
testing::test::foo: true
testing::test::bar: false
(defaults from manifest inverted)
Output:
+# This is sample file:
+# some content if foo is true
+# content if bar is true
+# foo value: true
+# bar value: true
+
+# same for hiera variable:
+
+# some content if foo is true
+# foo value from hiera: true
+# bar value from hiera: false
Expected result:
bar should be false everywhere.
--
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://projects.puppetlabs.com/my/account
--
You received this message because you are subscribed to the Google Groups
"Puppet Bugs" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/puppet-bugs?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.