Gitlab::AppLogger cannot be accessed from ee/app/helpers/ee/kerberos_spnego_helper.rb
Summary
Customer in ZD-174327 has encountered a Kerberos error but we cannot see what it is due to:
"NameError","exception.message":"uninitialized constant EE::Gitlab::AppLogger\nDid you mean? Approver"
Related to the changes made in !41052 (merged) !41048 (merged).
Steps to reproduce
This is reproducible at the rails console by attempting to access the AppLogger from within the EE module as is kerberos_spnego_helper.rb:
irb(main):039:0> module EE
irb(main):040:1> begin
irb(main):041:2> raise 'This exception will be rescued!'
irb(main):042:2> rescue StandardError => e
irb(main):043:2> Gitlab::AppLogger.error "#{e.message}"
irb(main):044:2> end
irb(main):045:1> end
Traceback (most recent call last):
3: from (irb):39
2: from (irb):40:in `<module:EE>'
1: from (irb):43:in `rescue in <module:EE>'
NameError (uninitialized constant EE::Gitlab::AppLogger)
Did you mean? Approver
Adding a double-colon to Gitlab::AppLogger.error
to allow it to access methods outside of the EE module works around the issue:
irb(main):046:0> module EE
irb(main):047:1> begin
irb(main):048:2> raise 'This exception will be rescued!'
irb(main):049:2> rescue StandardError => e
irb(main):050:2> ::Gitlab::AppLogger.error "#{e.message}"
irb(main):051:2> end
irb(main):052:1> end
=> [Gitlab::AppTextLogger, Gitlab::AppJsonLogger]
What is the current bug behavior?
AppLogger method can't be found.
What is the expected correct behavior?
AppLogger should write the relevant event to the log.
Relevant logs and/or screenshots
Output of checks
Results of GitLab environment info
Happens on 13.4.x
Results of GitLab application Check
Possible fixes
Prepend Gitlab.AppLogger.error with a double colon so that it can access methods outside of the EE module.
Edited by Peter Leitzen