Commit 25d58051 authored by Kamil Trzciński's avatar Kamil Trzciński

Merge branch 'cat-warn-db-validateconfig-connection-errors' into 'master'

Warn for db:validate_config rake task connection problems

See merge request gitlab-org/gitlab!84299
parents 86b5b35d 0ebb5416
...@@ -20,7 +20,9 @@ namespace :gitlab do ...@@ -20,7 +20,9 @@ namespace :gitlab do
begin begin
ActiveRecord::Base.establish_connection(db_config) # rubocop: disable Database/EstablishConnection ActiveRecord::Base.establish_connection(db_config) # rubocop: disable Database/EstablishConnection
ActiveRecord::Base.connection.select_one("SELECT system_identifier, current_database() FROM pg_control_system()") ActiveRecord::Base.connection.select_one("SELECT system_identifier, current_database() FROM pg_control_system()")
rescue ActiveRecord::NoDatabaseError, ActiveRecord::ConnectionNotEstablished, PG::ConnectionBad rescue ActiveRecord::ConnectionNotEstablished, PG::ConnectionBad => err
warn "WARNING: Could not establish database connection for #{db_config.name}: #{err.message}"
rescue ActiveRecord::NoDatabaseError
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