Class: Puppet::Pops::Binder::Hiera2::ConfigChecker
- Defined in:
- lib/puppet/pops/binder/hiera2/config_checker.rb
Overview
Validates the consistency of a Hiera2::Config
Instance Method Summary collapse
-
#initialize(diagnostics) ⇒ ConfigChecker
constructor
Create an instance with a diagnostic producer that will receive the result during validation.
-
#validate(data, config_file) ⇒ Object
Validate the consistency of the given data.
Constructor Details
#initialize(diagnostics) ⇒ ConfigChecker
Create an instance with a diagnostic producer that will receive the result during validation
8 9 10 |
# File 'lib/puppet/pops/binder/hiera2/config_checker.rb', line 8 def initialize(diagnostics) @diagnostics = diagnostics end |
Instance Method Details
#validate(data, config_file) ⇒ Object
Validate the consistency of the given data. Diagnostics will be emitted to the DiagnosticProducer that was set when this checker was created
17 18 19 20 21 22 23 24 25 26 |
# File 'lib/puppet/pops/binder/hiera2/config_checker.rb', line 17 def validate(data, config_file) if data.is_a?(Hash) # If the version is missing, it is not meaningful to continue return unless check_version(data['version'], config_file) check_hierarchy(data['hierarchy'], config_file) check_backends(data['backends'], config_file) else @diagnostics.accept(Issues::CONFIG_IS_NOT_HASH, config_file) end end |