|
The hiera_hash function fails with type error when a key is empty (or wrong type), which makes sense but the error message doesn't provide much information to help debug the issue:
Error: Could not run: Hiera type mismatch: expected Hash and got NilClass
|
It would be nice if it contained:
-
Where in puppet manifest was hiera_hash function called from (file name + line number)
-
Where in hiera is the offending key stored (file name + line number)
Here is an example to reproduce the issue:
#-- Assuming hiera.yaml
|
:hierarchy:
|
- web01.example.com
|
- common
|
|
#-- Assuming common.yaml:
|
users:
|
regular:
|
'cdouglas': 'Carrie Douglas'
|
|
#-- Assuming web01.example.com.yaml:
|
users:
|
# administrators:
|
# 'aberry': 'Amy Berry'
|
The case where I saw this happen is when user hashed out a bunch of values but left the top level key as illustrated above. Took a while to hunt it down in the hierarchy and wasn't immediately obvious what happened.
|