Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'lib/system_check/incoming_email/mail_room_enabled_check.rb')
-rw-r--r--lib/system_check/incoming_email/mail_room_enabled_check.rb42
1 files changed, 42 insertions, 0 deletions
diff --git a/lib/system_check/incoming_email/mail_room_enabled_check.rb b/lib/system_check/incoming_email/mail_room_enabled_check.rb
new file mode 100644
index 00000000000..8e725aabd03
--- /dev/null
+++ b/lib/system_check/incoming_email/mail_room_enabled_check.rb
@@ -0,0 +1,42 @@
+# frozen_string_literal: true
+
+module SystemCheck
+ module IncomingEmail
+ class MailRoomEnabledCheck < SystemCheck::BaseCheck
+ include ::SystemCheck::InitHelpers
+ set_name 'Mailroom enabled?'
+
+ def skip?
+ omnibus_gitlab?
+ end
+
+ def check?
+ mail_room_enabled? || mail_room_configured?
+ end
+
+ def show_error
+ try_fixing_it(
+ 'Enable mail_room'
+ )
+ for_more_information(
+ 'doc/administration/reply_by_email.md'
+ )
+ fix_and_rerun
+ end
+
+ private
+
+ def mail_room_enabled?
+ target = '/usr/local/lib/systemd/system/gitlab.target'
+ service = '/usr/local/lib/systemd/system/gitlab-mailroom.service'
+
+ File.exist?(target) && File.exist?(service) && systemd_get_wants('gitlab.target').include?("gitlab-mailroom.service")
+ end
+
+ def mail_room_configured?
+ path = '/etc/default/gitlab'
+ File.exist?(path) && File.read(path).include?('mail_room_enabled=true')
+ end
+ end
+ end
+end