debian-mirror-gitlab/lib/system_check/incoming_email/mail_room_enabled_check.rb

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

43 lines
1 KiB
Ruby
Raw Normal View History

2018-12-13 13:39:08 +05:30
# frozen_string_literal: true
2018-03-17 18:26:18 +05:30
module SystemCheck
module IncomingEmail
2021-12-11 22:18:48 +05:30
class MailRoomEnabledCheck < SystemCheck::BaseCheck
include ::SystemCheck::InitHelpers
set_name 'Mailroom enabled?'
2018-03-17 18:26:18 +05:30
def skip?
omnibus_gitlab?
end
def check?
2021-12-11 22:18:48 +05:30
mail_room_enabled? || mail_room_configured?
2018-03-17 18:26:18 +05:30
end
def show_error
try_fixing_it(
2021-12-11 22:18:48 +05:30
'Enable mail_room'
2018-03-17 18:26:18 +05:30
)
for_more_information(
'doc/administration/reply_by_email.md'
)
fix_and_rerun
end
private
2021-12-11 22:18:48 +05:30
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
2018-03-17 18:26:18 +05:30
def mail_room_configured?
path = '/etc/default/gitlab'
File.exist?(path) && File.read(path).include?('mail_room_enabled=true')
end
end
end
end