Module: Fluent::Auditify::Plugin::YamlConfNoErrorParser
- Included in:
- YamlConf
- Defined in:
- lib/fluent/auditify/plugin/parse_noerror.rb
Instance Method Summary collapse
-
#detect_no_match(root, conf) ⇒ Object
config: - source: $type: stdout.
-
#detect_no_source(root, conf) ⇒ Object
config: - match: $type: stdout.
-
#detect_wrong_directive(root, conf) ⇒ Object
config: - unknown: $type: stdout.
Instance Method Details
#detect_no_match(root, conf) ⇒ Object
config:
- source:
$type: stdout
49 50 51 52 53 54 |
# File 'lib/fluent/auditify/plugin/parse_noerror.rb', line 49 def detect_no_match(root, conf) return if unknown_directive?(root) unless root.elements.any? { |v| 'match' == v.name } guilty(:warn, "no match directive", { path: conf }) end end |
#detect_no_source(root, conf) ⇒ Object
config:
- match:
$type: stdout
37 38 39 40 41 42 |
# File 'lib/fluent/auditify/plugin/parse_noerror.rb', line 37 def detect_no_source(root, conf) return if unknown_directive?(root) unless root.elements.any? { |v| 'source' == v.name } guilty(:warn, "no source directive", { path: conf }) end end |
#detect_wrong_directive(root, conf) ⇒ Object
config:
- unknown:
$type: stdout
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/fluent/auditify/plugin/parse_noerror.rb', line 16 def detect_wrong_directive(root, conf) return if [] != root.elements # no valid root elements here yaml = YAML.load(file_get_contents(conf)) unknowns = yaml.keys.select { |v| not %w(system: config:).include?(v) } file_readlines_each(conf) do |line, index| unknowns.each do |directive| if line.chomp.include?(directive) guilty(:error, "top level directive must be system or config, not <#{directive}>", { path: conf, line: index + 1, content: line.chomp}) end end end end |