我试图用puppetbuild立一个新的节点,但是它失败了,导致我认为hiera没有find正确的数据源:
Server Error: Evaluation Error: Error while evaluating a Function Call, undefined method `empty?' for nil:NilClass at ${line 4 in some selfwritten class}
我也有这个错误,但我不记得我改变了什么(如果有的话),导致它:
Server Error: Evaluation Error: Error while evaluating a Function Call, Unknown alias: 3B4007E7596ADF847ECA510D57069DBF2B3DB006 at ${line 4 in the same selfwritten class}
木偶抱怨的class级线路是这样的:
$network = hiera("network")
这是class上的第一行。 相同的查找在不同的节点上工作。
我的/etc/puppetlabs/puppet/hiera.yaml看起来像这样
--- :backends: - yaml :hierarchy: - "nodes/%{::trusted.certname}" - "customer/%{customer}" - "preview/%{preview}" - "test/%{test}" - common :yaml: # datadir is empty here, so hiera uses its defaults: # - /etc/puppetlabs/code/environments/%{environment}/hieradata on *nix # - %CommonAppData%\PuppetLabs\code\environments\%{environment}\hieradata on Windows # When specifying a datadir, make sure the directory exists. :datadir:
这个新的节点有它的清单
$customer='foo'
而工作节点有
$customer='bar'
我有每个yaml文件,yamllint显示neiter错误,也没有警告hiera.yaml或下面两个。
ls /etc/puppetlabs/code/environments/production/hieradata/customer/ foo.yaml bar.yaml
它们各自的yaml文件中的第一行为这个值networking定义了一个string:
network: "172.28.11"
我试过使用木偶查找来debugging这个问题,迄今没有成功
puppet lookup --environment production --debug --explain --node foo-app1.domain.tld --compile network <snip lots of unrelated stuff> Debug: hiera(): Looking for data source customer/foo Error: Could not run: Evaluation Error: Error while evaluating a Function Call, Unknown alias: 3B4007E7596ADF847ECA510D57069DBF2B3DB006 at {same class and line}
如果我在没有编译的情况下运行这个命令,它会退出而没有错误,而且也不查找客户数据源
那么:为什么这个节点失败了hiera查找? 我如何解决它? 如何正确使用木偶查找从工作节点获取这个值? (帮助debugging)