summaryrefslogtreecommitdiff
path: root/lib/system_check/app/tmp_writable_check.rb
blob: 99a75e57abf3cc25a8eef038f6cbe764ebd006aa (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
module SystemCheck
  module App
    class TmpWritableCheck < SystemCheck::BaseCheck
      set_name 'Tmp directory writable?'

      def check?
        File.writable?(tmp_path)
      end

      def show_error
        try_fixing_it(
          "sudo chown -R gitlab #{tmp_path}",
          "sudo chmod -R u+rwX #{tmp_path}"
        )
        for_more_information(
          see_installation_guide_section 'GitLab'
        )
        fix_and_rerun
      end

      private

      def tmp_path
        Rails.root.join('tmp')
      end
    end
  end
end