Skip to content

Commit 16a2024

Browse files
committed
Print proper error message instead of stacktrace when rmt config cannot get read
1 parent b9b42de commit 16a2024

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

bin/rmt-cli

+6
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,12 @@ if Settings.try(:host_system).blank? && File.exist?(RMT::CREDENTIALS_FILE_LOCATI
4242
warn "Run as root or adjust the permissions."
4343
end
4444

45+
unless Settings['database']
46+
warn "Error loading database config."
47+
warn 'Please make sure that /etc/rmt.conf is readable by the rmt process and has your database configured.'
48+
exit RMT::CLI::Error::ERROR_OTHER
49+
end
50+
4551
db_config = RMT::Config.db_config
4652
ActiveRecord::Base.establish_connection(db_config)
4753

0 commit comments

Comments
 (0)