无法在 puppet.conf 中启用 Future Parser

无法在 puppet.conf 中启用 Future Parser

重现步骤

  1. 启用未来的解析器,如中所述本文档

/etc/puppet/puppet.conf

[main]
parser = future
  1. 将 lambda 代码添加到 pp 文件

网站.pp

$systems = [
  'system01',
  'system02',
  'system03',
  'system04',
  'system05',
  'system06',
  'system07',
  'system08',
  'system09',
  'system10'
]

each($systems) |$value| { notify $value }
  1. 运行木偶

结果

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

尝试解决问题

  1. 通过谷歌搜索既没有Could not parse for environment production: This Name is not productive找到A non productive construct may only be placed last in a block/sequence解决问题的答案。
  2. 移至each($systems) |$value| { notify $value }文件末尾也未能解决问题

答案1

each($systems) |$value| { notify $value }改为后就可以正常工作了each($systems) |$value| { notify {$value:} }

相关内容