Issue #21026 has been updated by Charlie Sharpsteen.

Description updated

----------------------------------------
Bug #21026: Passing boolean variables from hiera trough parameterized classes 
doesn't work as expected
https://projects.puppetlabs.com/issues/21026#change-92066

* 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:

<pre>
class testing::test(
    $foo = false,
    $bar = true,
) {

    file { '/tmp/foo.txt':
        content => template('testing/test.erb')
    }
}
</pre>

modules/testing/templates/test.erb:

<pre>
# 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']) %>
</pre>


Hiera data for above example:

<pre>
---
testing::test::foo: true
testing::test::bar: false
</pre>

(defaults from manifest inverted)

Output:
<pre>
+# 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
</pre>

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.


Reply via email to