It turns out that it would fail every time if…

Consistent failure if I didn't put `next if typename.nil?` before the rest of the statement.  This compromise puts 2 `next if` statements, then an implied `else` since those were the two conditions I needed to check 😄
This commit is contained in:
Aaron Mildenstein 2014-04-23 16:23:30 -05:00
parent 56b7f1b274
commit 6bf38771c1

View file

@ -120,10 +120,11 @@ class LogStash::Codecs::Collectd < LogStash::Codecs::Base
@logger.info("Getting Collectd typesdb info", :typesdb => path.to_s)
File.open(path, 'r').each_line do |line|
typename, *line = line.strip.split
next if typename.nil? || if typename[0,1] != '#' # Don't process commented or blank lines
v = line.collect { |l| l.strip.split(":")[0] }
types[typename] = v
end
@logger.debug("typename", :typename => typename.to_s)
next if typename.nil?
next if typename[0,1] == '#'
v = line.collect { |l| l.strip.split(":")[0] }
types[typename] = v
end
end
@logger.debug("Collectd Types", :types => types.to_s)