Presumably on my puppet master I can run hiera from the command line to see how a particular node would generate a variable set, but it's really hard to find a working example of that.
I've tried using the puppet inventory and using mcollective, both with an error:
[root@puppet001 hiera]# hiera -c /etc/puppet/hiera.yaml -i pamcontent001.mgs.example.com
Puppet inventory service lookup failed: NoMethodError: undefined method `features' for Puppet:Module
Could not load Puppet inventory service scope: SystemExit: exit
[root@puppet001 hiera]# hiera -c /etc/puppet/hiera.yaml -m pamcontent001.mgs.example.com
MCollective lookup failed: LoadError: cannot load such file -- mcollective
Could not load MCollective scope: SystemExit: exit
Searching on those error messages uncover some old bugs and their fixes, but no work around that will give me a test lookup.
How do you test and debug a heira lookup when you're getting an unexpected value?
You can't dump the whole of the hiera data for a node. If you look at the api for creating custom back-ends for hiera you'll see that there's nothing for returning the whole data set or a list of keys, just a way to get the value associated with a particular key. Keep in mind that a wide range of back-ends are possible.
You can look up the value for a specific key. eg:
Exactly what scope variables you need to provide this way will depend on which ones you use in your hiera.yaml file. You may find this useful.