title: Proper syntax for entry in Hiera yaml file
body: <p>The goal is to supply a default value for a parameter being passed to a defined resource type. I have successfully supplied defaults for class parameters using the automatic defaulting procedure that uses Hiera, but this mechanism does not work for defined types.</p>
  
  <p>Here is how I call Hiera in my defined type: </p>
  
  <pre><code>define git_down(
      $local_repo_dir = undef,
      $remote_repo_url = undef,
      $version = undef,
      $shell = hiera("git_down::shell"),
      $path = hiera("git_down::path"),
      $date_format = hiera("git_down::date_format", '%Y-%m-%d %H:%M:%S')
  ) {
  ... More puppet code for type definition...
  }
  </code></pre>
  
  <p>My idea is to create classes that have normal automatic defaults for some parameters keyed to the class name (hence done in the class files, not shown), but make other parameters get the same default for all users of the type, regardless of class. The above type is to permit updating a GIT repo. It needs to be a type and not a class, because I need to fetch files from multiple GIT repositories, and classes are singletons, while types may have multiple instances. Every class that declares a "git_down" instance should expect to find the git executables (git_down::path and git_down::shell) in the same place. What is different for each class is the URL of the source repo, the directory to store the local repo that is to be cloned or fetched into, and the version tag to checkout.</p>
  
  <p>Here is what my Hiera.yaml looks like:</p>
  
  <pre><code>---
  :backends: 
    - yaml
  :yaml:
    :datadir: c:/temp/usr
  :hierarchy:
    - "git_%{fqdn}"
    - "git_%{osfamily}"
    - git_common
  </code></pre>
  
  <p>(Note: I did not use ::fqdn and ::osfamily here because the standalone Hiera command line tool does not recognize them. I may add the double colons when I get everything working.)</p>
  
  <p>I do not have a machine specific YAML file (based on fqdn, the fully-qualified-domain-name) so it should look in my osfamily specific file, which is git_windows.yaml:</p>
  
  <pre><code>---
  # Default class parameters for when ::osfamily is "windows"
  git_checkout::local_repo_dir: c:/usr/git_test_5
  git_checkout::remote_repo_url: file:///c/usr/git_test
  git_checkout::version: v11.0.7.81
  git_down::shell: 'C:/Program Files (x86)/git/bin/sh.exe'
  git_down::path: '/bin:/C/Program Files (x86)/git/bin'
  git_down::date_format: '%Y-%m-%d %H:%M:%S'
  </code></pre>
  
  <p>I tested my Hiera this way:</p>
  
  <p>1) Use command line facter to create a YAML fact file with all my facts (as needed when running Hiera): </p>
  
  <pre><code>facter -y &gt; ..\facts.yaml
  </code></pre>
  
  <p>2) Use command line Hiera to see if it recognizes my variables:</p>
  
  <p>hiera -d -c ..\hiera.yaml -y ..\facts.yaml git_down::shell</p>
  
  <p>Hiera outputs the following:</p>
  
  <pre><code>c:\usr\git_type\manifests&gt;hiera.bat -d -c ..\hiera.yaml -y ..\facts.yaml git_down::shell
  DEBUG: 2014-07-01 14:17:46 -0400: Hiera YAML backend starting
  DEBUG: 2014-07-01 14:17:46 -0400: Looking up git_down::shell in YAML backend
  DEBUG: 2014-07-01 14:17:46 -0400: Looking for data source git_usb-pctbspaul.ef.com
  DEBUG: 2014-07-01 14:17:46 -0400: Cannot find datafile c:/usr/git_type/git_usb-pctbspaul.ef.com.yaml, skipping
  DEBUG: 2014-07-01 14:17:46 -0400: Looking for data source git_windows
  DEBUG: 2014-07-01 14:17:46 -0400: Found git_down::shell in git_windows
  nil
  </code></pre>
  
  <p>Instead of "nil", I should see "C:/Program Files (x86)/git/bin/sh.exe". What is wrong?</p>