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

Hiera does not correctly handle (false) Booleans returned by the backends

Added by Lars Francke about 4 years ago. Updated about 3 years ago.

Status:Merged - Pending ReleaseStart date:03/26/2012
Priority:NormalDue date:
Assignee:Kelsey Hightower% Done:


Target version:1.0.0
Keywords:lowrider customer Affected Hiera Version:

We've Moved!

Ticket tracking is now hosted in JIRA:


This is similar to but not the same as issue #10590.

When any backend returns a false boolean (YAML for example) the lookup fails:

err: Could not retrieve catalog from remote server: Error 400 on SERVER: Could not find data item foo in any Hiera data file and no default supplied at ... on node ...

This is because in the backend.rb lookup method there is this code:

break if answer

which doesn’t work if answer is “false”. I don’t know the proper way of fixing this. In YAML one can just quote the values or in parse_answer return data.to_s instead of just data.

This is on hiera-0.3.0.

Related issues

Related to Hiera - Bug #12122: Hiera support for multiple backend Closed 01/24/2012


#1 Updated by Krzysztof Wilczynski about 4 years ago


This might be somewhat related to #10590.


#2 Updated by Carla Souza about 4 years ago


I guess this was solved in this pull request by checking answer’s value is not nil instead of the line:

break if answer


#3 Updated by Lars Francke about 4 years ago

Thanks Carla,

that indeed looks very much like that pull request might fix it. I looked through other open issues but didn’t look at pull requests… Great!

Unfortunately the patch doesn’t work properly either but I’ve commented on the pull request.

#4 Updated by Kelsey Hightower about 4 years ago

  • Status changed from Unreviewed to Accepted

#5 Updated by Kelsey Hightower almost 4 years ago

  • Assignee set to Kelsey Hightower
  • Target version set to 1.0.0
  • Keywords set to lowrider

I believe this bug should be fixed as part of the RC process and should make it into Hiera 1.0.0

#6 Updated by Kelsey Hightower almost 4 years ago

This all boils down to Hiera not supporting booleans as valid answers. Since Hiera is checking the the bankend’s response for a value that is “True” based on Ruby’s boolean logic, “False” values will never be returned.

When using the YAML backed end the following values are “False”:

  • “false”
  • False
  • “n”
  • “N”

That’s based on the YAML Spec.

I’m a bit worried that people maybe relying on Hiera’s current behavior and changing how this works can cause a negative impact to our users. The next release of Hiera is aimed at stabilizing the current behavior. However, I’m willing to make a patch for this and get feedback from the community. If the change is desired I’ll issue a pull request against the RC branch.

#7 Updated by Kelsey Hightower almost 4 years ago

Ok, so I’ve verified that Hiera does allow backends to return Boolean values. There are even a bunch of tests already in place for this:

Now that I’ve confirmed that Hiera seems to be working. I will take a look at the paser function.

#8 Updated by Kelsey Hightower almost 4 years ago

So I’ve taken a look at the Puppet parser function and it seems to allow boolean values. I’m testing this on the master branch of hiera-puppet. To help me reproduce this issue can you provide the version of puppet-hiera, an example manifests, and an example of the YAML data you’re using?

#9 Updated by Lars Francke almost 4 years ago

As mentioned above all of this was on Hiera 0.3.0 and I even pointed to the code where the failure happens. Any YAML file with a false boolean value “foo: false” failed. I haven’t tried with the latest 1.0 RC but looking at the lookup.rb code the same bug still seems to be there. Please also look at Carla’s fix above.

If I understand the tests properly they test something else. The second one at least tests if the Backends properly return “false” which they do! The problem is in hiera’s lookup method.

Please let me know if I should go into more detail.

#11 Updated by Kelsey Hightower almost 4 years ago

  • Status changed from Accepted to Merged - Pending Release
  • Branch set to

#12 Updated by Charlie Sharpsteen about 3 years ago

  • Keywords changed from lowrider to lowrider customer

Also available in: Atom PDF