require 'rubygems' require 'puppetlabs_spec_helper/rake_tasks' Rake::Task[:lint].clear task :lint => ['lint:lint', 'lint:hiera_array'] namespace :lint do PuppetLint::RakeTask.new :lint do |config| config.fail_on_warnings = false config.disable_checks = [ 'autoloader_layout', 'class_parameter_defaults', 'class_inherits_from_params_class', '80chars' ] end task :hiera_array do |t| error = false Dir.glob('./**/*.pp') do |manifest| result = `grep -n 'hiera_array(.*[A-Za-z]_roles.*)' #{manifest}` if $?.success? line = result.split(':')[0] $stderr.puts "ERROR: potentially dangerous hiera_array call found in #{manifest}:#{line}" error = true end end if error fail end end end