我在hiera YAML文件中的以下值:計算錯誤而使用Hiera散列木偶
test::config_php::php_modules :
-'soap'
-'mcrypt'
-'pdo'
-'mbstring'
-'php-process'
-'pecl-memcache'
-'devel'
-'php-gd'
-'pear'
-'mysql'
-'xml'
和下面是我的測試類:
class test::config_php (
$php_version,
$php_modules = hiera_hash('php_modules', {}),
$module_name,
){
class { 'php':
version => $php_version,
}
$php_modules.each |String $php_module| {
php::module { $php_module: }
}
}
在運行我的傀儡體現我得到以下錯誤:
Error: Evaluation Error: Error while evaluating a Function Call, create_resources(): second argument must be a hash at /tmp/vagrant-puppet/modules-f38a037289f9864906c44863800dbacf/ssh/manifests/init.pp:46:3 on node testdays-1a.vagrant.loc.vag
I am quite confused on what exactly am I doing wrong. My puppet version is 3.6.2 and I also have parser = future
我真的很感謝這裏的任何幫助。
非常感謝您的建議和鏈接,但即使在添加更改Yaml後,我似乎也遇到同樣的問題。 – Spaniard89
看來我沒有正確閱讀評估。您正在使用您未在代碼中顯示的create_resources函數。你能向我們展示這件作品嗎? 檢查函數的第二個參數是散列。 你可以從這裏找到如何做到這一點https://docs.puppet.com/hiera/3.1/data_sources.html – Jamie