我在将哈希从 hiera 传递到资源创建时遇到了一些问题。
vhosts:
project_1:
name: project_1
project_name: project_1
project_2:
name: project_2
project_name: project_2
$vhosts = hiera('vhosts', [])
create_resources(project_vhosts::vhosts, $vhosts)
忽略隐藏的项目名称:) 但你明白了要点。我的资源如下所示:
define project_vhosts::vhosts(
$vhosts = []
){
notice($vhosts)
}
我的木偶运行后出现这些错误
Error: Invalid parameter project_name on project_vhosts::Vhosts[project_1] on node *
Wrapped exception:
Invalid parameter project_name
Error: Invalid parameter project_name on project_vhosts::Vhosts[project_1] on *
我知道它希望我将参数直接实现到类中。但是,我真正想要的是资源中对我整体可用的哈希。我在这里做错了什么?