Uploaded image for project: 'Puppet'
  1. Puppet
  2. PUP-5048

Hiera 3.0.1 + Puppet 4.2.1 can't manage empty values in yaml datasource

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Normal
    • Resolution: Won't Fix
    • Affects Version/s: PUP 4.2.1
    • Fix Version/s: None
    • Component/s: None
    • Labels:
      None
    • Template:
    • Team:
      Puppet Developer Experience

      Description

      I'm facing some issues to use Hiera 3.0.1 with Puppet 4.2.
      When applying my puppet manifest using this command:

      puppet apply environments/production/manifests/init.pp --hiera_config=hiera.yaml
      I get the following error:

      Error: Evaluation Error: Error while evaluating a Function Call, Could not find data item myclass::ensure in any Hiera data file and no default supplied at /home/vagrant/temp/environments/production/manifests/init.pp:13:39 on node a

      Here is the directory structure :

      {{$ tree
          .
          ├── environments
          │   └── production
          │       ├── config.yaml
          │       └── manifests
          │           └── init.pp
          └── hiera.yaml}}
      

      content of config.yaml:

      {{$ cat hiera.yaml 
          ---
          :backends:
            - yaml
          
          :hierarchy:
            - config
          
          :yaml:
            :datadir: environments/production
      }}
      

      content of init.pp:

      {{class myclass(
            $version                          = $myclass::params::version,
            $ensure                           = $myclass::params::ensure,
          ) inherits myclass::params {
          
            notify {"$version": }
            notify {"$ensure": }
          
          }
          
          class myclass::params {
            $version                          = hiera('myclass::version', '1.0.0')
            $ensure                           = hiera('myclass::ensure', 'running')
          }
          
          class {'myclass': }
      }}
      

      content of hiera data source:

      {{$ cat config.yaml
          ---
          myclass::version: '1.0.0'
          myclass::ensure:
      }}
      

      Looks like Hiera can't handle empty values from a yaml data source and/or replace them by default value

        Attachments

          Activity

            People

            • Assignee:
              Puppeteer Mohamed HADROUJ
              Reporter:
              Puppeteer Mohamed HADROUJ
            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Zendesk Support