Class: Puppet::Pops::Binder::Config::DiagnosticProducer

Inherits:
Object
  • Object
show all
Defined in:
lib/puppet/pops/binder/config/diagnostic_producer.rb

Overview

Generates validation diagnostics

Instance Method Summary collapse

Constructor Details

#initialize(acceptor) ⇒ DiagnosticProducer

Returns a new instance of DiagnosticProducer.



6
7
8
9
# File 'lib/puppet/pops/binder/config/diagnostic_producer.rb', line 6

def initialize(acceptor)
  @acceptor = acceptor
  @severity_producer = Validation::SeverityProducer.new
end

Instance Method Details

#accept(issue, semantic, arguments = {}) ⇒ Object



11
12
13
14
15
# File 'lib/puppet/pops/binder/config/diagnostic_producer.rb', line 11

def accept(issue, semantic, arguments={})
  arguments[:semantic] ||= semantic
  severity = severity_producer.severity(issue)
  @acceptor.accept(Validation::Diagnostic.new(severity, issue, nil, nil, arguments))
end

#errors?Boolean

Returns:

  • (Boolean)


17
18
19
# File 'lib/puppet/pops/binder/config/diagnostic_producer.rb', line 17

def errors?()
  @acceptor.errors?
end

#severity_producerObject



21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/puppet/pops/binder/config/diagnostic_producer.rb', line 21

def severity_producer
  p = @severity_producer
  # All are errors, if there is need to mark some as warnings...
  # p[Issues::XXX] = :warning

  # ignored because there is a default
  p[Issues::CONFIG_LAYERS_MISSING] = :ignore

  # ignored because there is a default
  p[Issues::CONFIG_CATEGORIES_MISSING] = :ignore
  p
end