Add latest changes from gitlab-org/gitlab@master

This commit is contained in:
GitLab Bot 2020-09-06 12:08:40 +00:00
parent ef1719209e
commit 07e23c70f1
5 changed files with 11 additions and 6 deletions

View File

@ -0,0 +1,5 @@
---
title: Use GitLab AppLogger
merge_request: 41261
author: Rajendra Kadam
type: other

View File

@ -248,7 +248,7 @@ module Gitlab
begin begin
custom_options[:cert] = OpenSSL::X509::Certificate.new(custom_options[:cert]) custom_options[:cert] = OpenSSL::X509::Certificate.new(custom_options[:cert])
rescue OpenSSL::X509::CertificateError => e rescue OpenSSL::X509::CertificateError => e
Rails.logger.error "LDAP TLS Options 'cert' is invalid for provider #{provider}: #{e.message}" # rubocop:disable Gitlab/RailsLogger Gitlab::AppLogger.error "LDAP TLS Options 'cert' is invalid for provider #{provider}: #{e.message}"
end end
end end
@ -256,7 +256,7 @@ module Gitlab
begin begin
custom_options[:key] = OpenSSL::PKey.read(custom_options[:key]) custom_options[:key] = OpenSSL::PKey.read(custom_options[:key])
rescue OpenSSL::PKey::PKeyError => e rescue OpenSSL::PKey::PKeyError => e
Rails.logger.error "LDAP TLS Options 'key' is invalid for provider #{provider}: #{e.message}" # rubocop:disable Gitlab/RailsLogger Gitlab::AppLogger.error "LDAP TLS Options 'key' is invalid for provider #{provider}: #{e.message}"
end end
end end

View File

@ -218,7 +218,7 @@ module Gitlab
def expire_method_caches(methods) def expire_method_caches(methods)
methods.each do |name| methods.each do |name|
unless cached_methods.include?(name.to_sym) unless cached_methods.include?(name.to_sym)
Rails.logger.error "Requested to expire non-existent method '#{name}' for Repository" # rubocop:disable Gitlab/RailsLogger Gitlab::AppLogger.error "Requested to expire non-existent method '#{name}' for Repository"
next next
end end

View File

@ -168,7 +168,7 @@ AtlErSqafbECNDSwS5BX8yDpu5yRBJ4xegO/rNlmb8ICRYkuJapD1xXicFOsmfUK
end end
it 'logs an error when an invalid key or cert are configured' do it 'logs an error when an invalid key or cert are configured' do
allow(Rails.logger).to receive(:error) allow(Gitlab::AppLogger).to receive(:error)
stub_ldap_config( stub_ldap_config(
options: { options: {
'host' => 'ldap.example.com', 'host' => 'ldap.example.com',
@ -183,7 +183,7 @@ AtlErSqafbECNDSwS5BX8yDpu5yRBJ4xegO/rNlmb8ICRYkuJapD1xXicFOsmfUK
config.adapter_options config.adapter_options
expect(Rails.logger).to have_received(:error).with(/LDAP TLS Options/).twice expect(Gitlab::AppLogger).to have_received(:error).with(/LDAP TLS Options/).twice
end end
context 'when verify_certificates is enabled' do context 'when verify_certificates is enabled' do

View File

@ -302,7 +302,7 @@ RSpec.describe Gitlab::RepositoryCacheAdapter do
it 'does not expire caches for non-existent methods' do it 'does not expire caches for non-existent methods' do
expect(cache).not_to receive(:expire).with(:nonexistent) expect(cache).not_to receive(:expire).with(:nonexistent)
expect(Rails.logger).to( expect(Gitlab::AppLogger).to(
receive(:error).with("Requested to expire non-existent method 'nonexistent' for Repository")) receive(:error).with("Requested to expire non-existent method 'nonexistent' for Repository"))
repository.expire_method_caches(%i(nonexistent)) repository.expire_method_caches(%i(nonexistent))