The Puppet Labs Issue Tracker has Moved:

This issue tracker is now in read-only archive mode and automatic ticket export has been disabled. Redmine users will need to create a new JIRA account to file tickets using See the following page for information on filing tickets with JIRA:

Bug #3704

Facter doesn't return booleans (converts them to strings instead)

Added by Sebastian Kayser about 6 years ago. Updated over 4 years ago.

Status:DuplicateStart date:04/29/2010
Priority:NormalDue date:
Assignee:-% Done:


Target version:-
Keywords: Affected Facter version:

We've Moved!

Ticket tracking is now hosted in JIRA:


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 where Luke asked to file a bug report. As I couldn’t find one, here it goes.


$ ls
test.pp  test.rb

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

$ cat test.pp
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
$ facter --version

Related issues

Duplicates Facter - Feature #4561: Structured data should be supported Closed 05/18/2012 05/18/2012


#1 Updated by James Turnbull about 6 years ago

  • Category set to library
  • Status changed from Unreviewed to Accepted
  • Target version set to 14

#2 Updated by Anonymous over 5 years ago

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.

#3 Updated by Miguel Di Ciurcio Filho over 4 years ago

Bumping this bug.

The following code does not work and gives this error: “Could not retrieve catalog from remote server: Error 400 on SERVER: No matching value for selector param ‘true’ at /etc/puppet/modules/elabsis/manifests/ntp.pp:6 on node”

package {"ntp":
                ensure  => $::is_virtual ? {
                        true => purged,
                        false => installed,

This one works:

package {"ntp":
                ensure  => $::is_virtual ? {
                        'true' => purged,
                        'false' => installed,

#4 Updated by Adrien Thebo over 4 years ago

We’ve been looking into adding more complex data types into Puppet, and as it turns out this is pretty hard. Right now we stringify all facts in Puppet after they’ve been retrieved, and changing this has some pretty significant changes in how Puppet handles facts. Puppet itself and applications using the stored facts that Puppet generates have all been built to expect that Puppet provides facts as string typed key/value pairs, and changing this requires a non-trivial amount of work inside of Puppet itself. Right now Facter itself can and will return arbitrary types, but we just can’t use them inside of Puppet.

#5 Updated by Anonymous over 4 years ago

  • Status changed from Accepted to Duplicate

This is basically a duplicate of #4561, which is a larger ticket covering various other sorts of structured data in Facter. I have closed this to better reflect that, but linked the two together so the details don’t get lost. Thanks.

#6 Updated by Ken Barber over 4 years ago

  • Target version deleted (14)

Also available in: Atom PDF