Issue #3704 has been updated by Daniel Pittman.

We have recently run into exactly this problem, with a fact that returned 
true/false.

Testing showed that puppet considered everything we could return except for the 
empty string to be "true"; we tested Ruby false, nil, and the number and string 
0 without success before finally settling on the empty string for a "false" 
value that puppet recognised.
----------------------------------------
Bug #3704: Facter doesn't return booleans (converts them to strings instead)
http://projects.puppetlabs.com/issues/3704

Author: Sebastian Kayser
Status: Accepted
Priority: Normal
Assignee: 
Category: library
Target version: 2.0.0
Keywords: 
Branch: 


I am just getting started with puppet/facter and it took me a quite while to 
realize that facter seems to convert custom boolean facts to strings (tried 
boolean comparisons in my puppet recipes for ages before realizing it). This 
has also been reported here 
http://groups.google.de/group/puppet-users/msg/c1939ed3b4404668 where Luke 
asked to file a bug report. As I couldn't find one, here it goes.

Example:

<pre>
$ ls
test.pp  test.rb

$ cat test.rb
Facter.add("myfact") do
  setcode do
    true
  end
end

$ cat test.pp
notice($myfact)
if $myfact == true {
  notice("Boolean ... just like I expected!") 
} else { if $myfact == 'true' {
  notice("Houston ... it's a string!")
}}

$ FACTERLIB=. puppet test.pp
notice: Scope(Class[main]): true
notice: Scope(Class[main]): Houston ... it's a string!

$ puppet --version
0.25.4
$ facter --version
1.5.7
</pre>


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