Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fluentd: Suppress unread configuration warning #1242

Merged
merged 2 commits into from
Nov 11, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ $LOAD_PATH.push File.expand_path('lib', __dir__)

Gem::Specification.new do |spec|
spec.name = 'fluent-plugin-grafana-loki'
spec.version = '1.2.1'
spec.version = '1.2.2'
spec.authors = %w[woodsaj briangann]
spec.email = ['[email protected]', '[email protected]']

Expand Down
12 changes: 7 additions & 5 deletions fluentd/fluent-plugin-grafana-loki/lib/fluent/plugin/out_loki.rb
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ def configure(conf)
@record_accessors = {}
conf.elements.select { |element| element.name == 'label' }.each do |element|
element.each_pair do |k, v|
element.key?(k) # to suppress unread configuration warning
element.has_key?(k) # rubocop:disable Style/PreferredHashMethods #to suppress unread configuration warning
v = k if v.empty?
@record_accessors[k] = record_accessor_create(v)
end
Expand All @@ -86,11 +86,13 @@ def configure(conf)
@remove_keys_accessors.push(record_accessor_create(key))
end

@cert = OpenSSL::X509::Certificate.new(File.read(@cert)) if @cert
@key = OpenSSL::PKey.read(File.read(key)) if @key
if [email protected]? && [email protected]?
@cert = OpenSSL::X509::Certificate.new(File.read(@cert)) if @cert
@key = OpenSSL::PKey.read(File.read(@key)) if @key

if [email protected]_a?(OpenSSL::PKey::RSA) && [email protected]_a?(OpenSSL::PKey::DSA)
raise "Unsupported private key type #{key.class}"
if [email protected]_a?(OpenSSL::PKey::RSA) && [email protected]_a?(OpenSSL::PKey::DSA)
raise "Unsupported private key type #{key.class}"
end
end

if !@ca_cert.nil? && !File.exist?(@ca_cert)
Expand Down