Search code examples
puppet

Puppet-lint warning when iterating over nested hash in puppet manifest


I am iterating over a hash of arrays in one of my puppet manifests

 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 }

but I get a puppet-lint warning.

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

The code is running well, so it's a question of puppet-lint. Maybe there is a way to configure puppet-lint to recognize variables in the lambda blocks?


Solution

  • This is a known issue in puppet-lint at the time of writing. It has limited support for Puppet 4 language features.