遍历 Puppet 清单中的嵌套哈希时出现 Puppet-lint 警告
Puppet-lint warning when iterating over nested hash in puppet manifest
我正在对我的一个人偶清单中的数组哈希进行迭代
1 # class to manage needed packages
2 class profile::packages (
3 ){
4 $packages = hiera_hash('profile::packages::managed', {})
5
6 if $packages != {} {
7 $packages.each | String $package_state, Array $packages_array | {
8 $packages_array.each | Integer $idx, String $package | {
9 notify { "${package} with ${idx} should be ${package_state}": }
10 }
11 }
12 }
13 }
但是我收到了 puppet-lint 警告。
WARNING: top-scope variable being used without an explicit namespace
on line 8
Blockquote
WARNING: top-scope variable being used without an explicit
namespace on line 9
代码 运行 很好,所以这是一个 puppet-lint 的问题。也许有一种方法可以配置 puppet-lint 以识别 lambda 块中的变量?
在撰写本文时,这是 a known issue 在 puppet-lint 中。它对 Puppet 4 语言功能的支持有限。
我正在对我的一个人偶清单中的数组哈希进行迭代
1 # class to manage needed packages
2 class profile::packages (
3 ){
4 $packages = hiera_hash('profile::packages::managed', {})
5
6 if $packages != {} {
7 $packages.each | String $package_state, Array $packages_array | {
8 $packages_array.each | Integer $idx, String $package | {
9 notify { "${package} with ${idx} should be ${package_state}": }
10 }
11 }
12 }
13 }
但是我收到了 puppet-lint 警告。
WARNING: top-scope variable being used without an explicit namespace on line 8 Blockquote WARNING: top-scope variable being used without an explicit namespace on line 9
代码 运行 很好,所以这是一个 puppet-lint 的问题。也许有一种方法可以配置 puppet-lint 以识别 lambda 块中的变量?
在撰写本文时,这是 a known issue 在 puppet-lint 中。它对 Puppet 4 语言功能的支持有限。