Hiera 3 + Puppet 4.2 can't manage empty value in yaml datasource

ぃ、小莉子 提交于 2019-12-13 20:24:58

问题


I'm facing some issues to use Hiera 3 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?

来源:https://stackoverflow.com/questions/32040999/hiera-3-puppet-4-2-cant-manage-empty-value-in-yaml-datasource

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!