23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
|
# File 'lib/threatinator/actions/run/action.rb', line 23
def exec
opts = {}
feed = registry.get(@config.feed_provider, @config.feed_name)
if feed.nil?
logger.error("Unknown feed: provider = #{@config.feed_provider}, name = #{@config.feed_name}")
raise Threatinator::Exceptions::UnknownFeed.new(@config.feed_provider, @config.feed_name)
end
output = build_output
feed_runner = Threatinator::FeedRunner.new(feed, output)
status = StatusObserver.new
feed_runner.add_observer(status)
@config.observers.each do |observer|
feed_runner.add_observer(observer)
end
feed_runner.run
if status.missed?
logger.error "#{status.missed} records were MISSED (neither parsed nor filtered). You may need to update your feed specification! Try increasing the logging level to DEBUG, or re-run with run.coverage_output='output.csv' to see which records were parsed/filtered/missed."
end
if status.errors?
logger.error "#{status.errors} records had errors! You may have a bug in your feed specification! Try increasing the logging level to DEBUG, or re-run with run.coverage_output='output.csv' to see which records had errors."
end
logger.info "#{status.total} records processed. #{status.parsed} parsed, #{status.filtered} filtered, #{status.missed} missed, #{status.errors} errors"
end
|