重现步骤
- 启用未来的解析器,如中所述本文档
/etc/puppet/puppet.conf
[main]
parser = future
- 将 lambda 代码添加到 pp 文件
网站.pp
$systems = [
'system01',
'system02',
'system03',
'system04',
'system05',
'system06',
'system07',
'system08',
'system09',
'system10'
]
each($systems) |$value| { notify $value }
- 运行木偶
结果
Error: Could not retrieve catalog from remote server: Error 400 on SERVER:
Could not parse for environment production: This Name is not productive.
A non productive construct may only be placed last in a block/sequence at
/etc/puppet/manifests/site.pp:38:27 on node vm-one.domain
Warning: Not using cache on failed catalog
Error: Could not retrieve catalog; skipping run
尝试解决问题
- 通过谷歌搜索既没有
Could not parse for environment production: This Name is not productive
找到A non productive construct may only be placed last in a block/sequence
解决问题的答案。 - 移至
each($systems) |$value| { notify $value }
文件末尾也未能解决问题
答案1
each($systems) |$value| { notify $value }
改为后就可以正常工作了each($systems) |$value| { notify {$value:} }
: