title: Puppet can't find data item from hiera
body: <p>I'm trying to build a Hiera configuration for my Puppet setup. My Hosts are FreeBSD and Debian systems. Therefore I have a configuration based on <code>::osfamily</code>. But since I'm making extensive use of Jails I would like to have a further breakdown of my FreeBSD hosts with <code>::virtual</code>.</p>
  
  <p>from <strong>hiera.yaml</strong>:</p>
  
  <pre><code>:hierarchy:
      - "osfamily/%{::osfamily}"
      - "%{::virtual}/%{::osfamily}"
      - common
  </code></pre>
  
  <p>And my data directory tree:</p>
  
  <pre><code>hieradata/
  |-- common.yaml
  |-- osfamily
  |   |-- Debian.yaml
  |   `-- FreeBSD.yaml
  |-- physical
  |   `-- FreeBSD.yaml
  |-- jailed
  `-- virtual
  </code></pre>
  
  <p>In my understandigs puppet should apply everything <strong>osfamily/FreeBSD.yaml</strong> and afterwards from <strong>physical/FreeBSD.yaml</strong> for a physical FreeBSD host.</p>
  
  <p>Now I want to install the CA-Certificates package on every host and have a class for that task:</p>
  
  <pre><code>class certificates ( $packageName = hiera('ca_package') ){
  
    # Install CA-Certificates
    package { $packageName:
      ensure   =&gt; installed,
    }
  }
  </code></pre>
  
  <p>That class is included from <strong>common.yaml</strong></p>
  
  <pre><code>classes:
      - certificates
  </code></pre>
  
  <p>And the <em>ca_package</em>-Variable is defined in <strong>osfamily/FreeBSD.yaml</strong>:</p>
  
  <pre><code>---
  rootuser: root
  rootgroup: wheel
  sshservicename: sshd
  ca_package: 'security/ca_root_nss'
  </code></pre>
  
  <p>When I do a hiera test on that variable, everything is working fine:</p>
  
  <pre><code># hiera -c /usr/local/etc/puppet/hiera.yaml ca_package ::osfamily=FreeBSD
  security/ca_root_nss
  #
  </code></pre>
  
  <p>But Puppet is (even in Jails) complaining, that the data item <code>ca_package</code> is not available.</p>
  
  <blockquote>
    <p>Error: Could not retrieve catalog from remote server: Error 400 on
    SERVER: Could not find data item ca_package in any Hiera data file and
    no default supplied at
    /usr/local/etc/puppet/modules/certificates/manifests/init.pp:2 on node
    puppet.fqdn</p>
  </blockquote>
  
  <p>What am I doing wrong?</p>