Hiera lookup question
Hi All,
If I do a lookup of a key in Hiera inside a Puppet manifest and if the key is not found, shouldn't hiera return 'nil' as opposed to throwing an error?
# puppet apply -e "notice(hiera('foo'))"
Error: Could not find data item foo in any Hiera data file and no default supplied on node ...
Error: Could not find data item foo in any Hiera data file and no default supplied on node ....
#hiera foo
nil
I need to configure some optional data in Hiera and use it in the manifest only if it is set, something like below
$foo_value = hiera('foo')
if $foo_value {
# do something
}
How do I implement this? Any help is greatly appreciated.
Thanks
-Sheshi