Created attachment 1043602 [details] hiera_osfamily_lookup.txt Description of problem: it looks like use of %{::osfamily} in the hierarchy does not expand to RedHat on RHEL, while the same works on Fedora; see use case attached to bug Version-Release number of selected component (if applicable): hiera-1.3.4-1.el7.noarch
FWIW, this doesn't appear to be a hiera problem. it was reported that this works in fedora, but the hiera version we have in OSP is identical to the version in Fedora. Same base tarball with no patches applied.
We seem to have the same problem with %{::uuid} from #1238807
Noticeably if one runs manually: facter --puppet osfamily or facter --puppet uuid these both work and return valid output as in "RedHat" or a valid UUID. Yet when we enlist in the hiera config a yaml using those variable, for example; "%{::osfamily}" then the contents of RedHat.yaml are not included. Same is for %{::uuid}.
/etc/puppet/hiera.yaml: --- :backends: - json - yaml :json: :datadir: /etc/puppet/hieradata :yaml: :datadir: /etc/puppet/hieradata :hierarchy: - "%{::osfamily}" - common /etc/puppet/hieradata/common.yaml: a_duck: baaa /etc/puppet/hieradata/RedHat.yaml: a_duck: gaaaa hiera -c /etc/puppet/hiera.yaml a_duck baaa hiera -c /etc/puppet/hiera.yaml a_duck ::osfamily=RedHat gaaaa facter --yaml > facts.yaml won't be enough as the variables won't have :: one has to have: ::osfamily: RedHat there See: https://docs.puppetlabs.com/hiera/1/command_line.html
This seems to work as expected when calling hiera() from within a puppet manifest rather than from the cmdline. I am not sure if this is the indended behaviour but if it is maybe we can close this?
Giulio: what matters is manifest behavior, though we should have the same result with CLI. Probably we should report the bug to puppetlabs directly, and investigate with the Puppet community. If you don't need to run CLI in OSP-d, I suggest we close the bug. You or Puppet team could take care of reporting & following-up the bug upstream in Hiera/Facter.
Fedora 22 showing same behaviour, closing as NOTABUG as this works as intended when hiera is called from the manifest. Thanks for helping.