Module: AbideDevUtils::Sce::Validate::ResourceData
- Defined in:
- lib/abide_dev_utils/sce/validate/resource_data.rb
Overview
Validation methods for resource data
Defined Under Namespace
Classes: ControlsWithoutMapsError
Class Method Summary collapse
Class Method Details
.controls_without_maps(module_dir = Dir.pwd) ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/abide_dev_utils/sce/validate/resource_data.rb', line 13 def self.controls_without_maps(module_dir = Dir.pwd) pupmod = AbideDevUtils::Ppt::PuppetModule.new(module_dir) benchmarks = AbideDevUtils::Sce::Benchmark.benchmarks_from_puppet_module(pupmod) without_maps = benchmarks.each_with_object({}) do |benchmark, hsh| puts "Validating #{benchmark.title}..." hsh[benchmark.title] = benchmark.controls.each_with_object([]) do |ctrl, no_maps| no_maps << ctrl.id unless ctrl.valid_maps? end end err = ['Found controls in resource data without maps.'] without_maps.each do |key, val| next if val.empty? err << val.unshift("#{key}:").join("\n ") end raise ControlsWithoutMapsError, err.join("\n") unless without_maps.values.all?(&:empty?) end |