b5abd8e467
Closes-bug: 1499803 Change-Id: I1dfb317edeb5e2efd9fa075d73d9fa10fb64fc06
35 lines
793 B
Ruby
35 lines
793 B
Ruby
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
|