Commit b8e67cb6 authored by Peter Leitzen's avatar Peter Leitzen

Merge branch 'app-logger-5' into 'master'

Use applogger in ee/gitlab/auth/ldap/sync

See merge request gitlab-org/gitlab!41051
parents 9e130f19 90ba61fa
---
title: Use applogger in some files of lib/gitlab/ldap/sync/*
merge_request: 41051
author: Rajendra Kadam
type: other
...@@ -45,7 +45,7 @@ module EE ...@@ -45,7 +45,7 @@ module EE
def ldap_group_member_dns(ldap_group_cn) def ldap_group_member_dns(ldap_group_cn)
ldap_group = Ldap::Group.find_by_cn(ldap_group_cn, adapter) ldap_group = Ldap::Group.find_by_cn(ldap_group_cn, adapter)
unless ldap_group.present? unless ldap_group.present?
logger.warn { "Cannot find LDAP group with CN '#{ldap_group_cn}'. Skipping" } logger.warn "Cannot find LDAP group with CN '#{ldap_group_cn}'. Skipping"
return [] return []
end end
...@@ -64,7 +64,7 @@ module EE ...@@ -64,7 +64,7 @@ module EE
ensure_full_dns!(member_dns) ensure_full_dns!(member_dns)
logger.debug { "Members in '#{ldap_group.name}' LDAP group: #{member_dns}" } logger.debug "Members in '#{ldap_group.name}' LDAP group: #{member_dns}"
# Various lookups in this method could return `nil` values. # Various lookups in this method could return `nil` values.
# Compact the array to remove those entries # Compact the array to remove those entries
...@@ -80,7 +80,7 @@ module EE ...@@ -80,7 +80,7 @@ module EE
dn_obj = ::Gitlab::Auth::Ldap::DN.new(dn) dn_obj = ::Gitlab::Auth::Ldap::DN.new(dn)
parsed_dn = dn_obj.to_a parsed_dn = dn_obj.to_a
rescue ::Gitlab::Auth::Ldap::DN::FormatError => e rescue ::Gitlab::Auth::Ldap::DN::FormatError => e
logger.error { "Found malformed DN: '#{dn}'. Skipping. Error: \"#{e.message}\"" } logger.error "Found malformed DN: '#{dn}'. Skipping. Error: \"#{e.message}\""
next next
end end
...@@ -90,12 +90,12 @@ module EE ...@@ -90,12 +90,12 @@ module EE
if parsed_dn.count > 2 if parsed_dn.count > 2
dn_obj.to_normalized_s dn_obj.to_normalized_s
elsif parsed_dn.count == 0 elsif parsed_dn.count == 0
logger.warn { "Found null DN. Skipping." } logger.warn "Found null DN. Skipping."
nil nil
elsif parsed_dn[0] == 'uid' elsif parsed_dn[0] == 'uid'
dn_for_uid(parsed_dn[1]) dn_for_uid(parsed_dn[1])
else else
logger.warn { "Found potentially malformed/incomplete DN: '#{dn}'" } logger.warn "Found potentially malformed/incomplete DN: '#{dn}'"
dn dn
end end
...@@ -150,19 +150,19 @@ module EE ...@@ -150,19 +150,19 @@ module EE
# rubocop: enable CodeReuse/ActiveRecord # rubocop: enable CodeReuse/ActiveRecord
def dn_filter_search(filter) def dn_filter_search(filter)
logger.debug { "Running filter \"#{filter}\" against #{provider}" } logger.debug "Running filter \"#{filter}\" against #{provider}"
dns = adapter.filter_search(filter).map(&:dn) dns = adapter.filter_search(filter).map(&:dn)
ensure_full_dns!(dns) ensure_full_dns!(dns)
logger.debug { "Found #{dns.count} matching users for filter #{filter}" } logger.debug "Found #{dns.count} matching users for filter #{filter}"
dns dns
end end
def logger def logger
Rails.logger # rubocop:disable Gitlab/RailsLogger ::Gitlab::AppLogger
end end
end end
end end
......
...@@ -41,7 +41,7 @@ module Gitlab ...@@ -41,7 +41,7 @@ module Gitlab
available = max_capacity - current_capacity available = max_capacity - current_capacity
if available < 0 if available < 0
Rails.logger.info("Mirror available capacity is below 0: #{available}") # rubocop:disable Gitlab/RailsLogger Gitlab::AppLogger.info("Mirror available capacity is below 0: #{available}")
available = 0 available = 0
end end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment