puppetlabs/hiera — pull request #154 by zaphod42 (2013-10-03 20:44:11+00:00)
Title: (#22777) Propagate errors from cached files

The Hiera::Filecache system would swallow any errors that occurred when
reading or processing a file's contents. This makes it nearly impossible for
any other systems to report errors and where they occurred because they only
show up in logs at debug level.

This changes the Hiera::Filecache to have a new method, read_file, that does
not try to mask errors. The original read method now just handles any errors
that read_file produces. The YAML and JSON backends have been updated to use
read_file so that any malformed YAML or JSON, or unreadable files, are
reported to the caller. This allows, for instance, puppet to properly report
that a value could not be read from hiera when processing data bindings
rather than the value simply not being there and the user getting the
default.