summaryrefslogtreecommitdiff
path: root/lib/system_check/app
diff options
context:
space:
mode:
authorGabriel Mazetto <brodock@gmail.com>2017-05-30 19:06:58 +0200
committerGabriel Mazetto <brodock@gmail.com>2017-05-31 14:33:03 +0200
commit3f187751d40a687ab9b76857c04849bab0f84357 (patch)
tree2165e91838e774e5c80dbd37eba88551526fe1e7 /lib/system_check/app
parentbca5603740f77667dda6355c457ad1791b4fa42e (diff)
downloadgitlab-ce-3f187751d40a687ab9b76857c04849bab0f84357.tar.gz
Fixed and improved some existing checks and SystemCheck library
Diffstat (limited to 'lib/system_check/app')
-rw-r--r--lib/system_check/app/database_config_exists_check.rb8
-rw-r--r--lib/system_check/app/git_config_check.rb32
-rw-r--r--lib/system_check/app/gitlab_config_up_to_date_check.rb (renamed from lib/system_check/app/gitlab_config_not_outdated_check.rb)8
-rw-r--r--lib/system_check/app/projects_have_namespace_check.rb2
-rw-r--r--lib/system_check/app/ruby_version_check.rb2
5 files changed, 18 insertions, 34 deletions
diff --git a/lib/system_check/app/database_config_exists_check.rb b/lib/system_check/app/database_config_exists_check.rb
index d557cee47b4..d1fae192350 100644
--- a/lib/system_check/app/database_config_exists_check.rb
+++ b/lib/system_check/app/database_config_exists_check.rb
@@ -15,17 +15,11 @@ module SystemCheck
'Check that the information in config/database.yml is correct'
)
for_more_information(
- see_database_guide,
+ 'doc/install/databases.md',
'http://guides.rubyonrails.org/getting_started.html#configuring-a-database'
)
fix_and_rerun
end
-
- private
-
- def see_database_guide
- 'doc/install/databases.md'
- end
end
end
end
diff --git a/lib/system_check/app/git_config_check.rb b/lib/system_check/app/git_config_check.rb
index 7f0c792eb35..198867f7ac6 100644
--- a/lib/system_check/app/git_config_check.rb
+++ b/lib/system_check/app/git_config_check.rb
@@ -5,7 +5,7 @@ module SystemCheck
'core.autocrlf' => 'input'
}.freeze
- set_name 'Git configured with autocrlf=input?'
+ set_name 'Git configured correctly?'
def check?
correct_options = OPTIONS.map do |name, value|
@@ -15,8 +15,18 @@ module SystemCheck
correct_options.all?
end
+ # Tries to configure git itself
+ #
+ # Returns true if all subcommands were successful (according to their exit code)
+ # Returns false if any or all subcommands failed.
def repair!
- auto_fix_git_config(OPTIONS)
+ return false unless is_gitlab_user?
+
+ command_success = OPTIONS.map do |name, value|
+ system(*%W(#{Gitlab.config.git.bin_path} config --global #{name} #{value}))
+ end
+
+ command_success.all?
end
def show_error
@@ -27,24 +37,6 @@ module SystemCheck
see_installation_guide_section 'GitLab'
)
end
-
- private
-
- # Tries to configure git itself
- #
- # Returns true if all subcommands were successfull (according to their exit code)
- # Returns false if any or all subcommands failed.
- def auto_fix_git_config(options)
- if !@warned_user_not_gitlab
- command_success = options.map do |name, value|
- system(*%W(#{Gitlab.config.git.bin_path} config --global #{name} #{value}))
- end
-
- command_success.all?
- else
- false
- end
- end
end
end
end
diff --git a/lib/system_check/app/gitlab_config_not_outdated_check.rb b/lib/system_check/app/gitlab_config_up_to_date_check.rb
index 8a4d7b29977..c609e48e133 100644
--- a/lib/system_check/app/gitlab_config_not_outdated_check.rb
+++ b/lib/system_check/app/gitlab_config_up_to_date_check.rb
@@ -1,9 +1,7 @@
module SystemCheck
module App
- class GitlabConfigNotOutdatedCheck < SystemCheck::BaseCheck
- set_name 'GitLab config outdated?'
- set_check_pass 'no'
- set_check_fail 'yes'
+ class GitlabConfigUpToDateCheck < SystemCheck::BaseCheck
+ set_name 'GitLab config up to date?'
set_skip_reason "can't check because of previous errors"
def skip?
@@ -18,7 +16,7 @@ module SystemCheck
def show_error
try_fixing_it(
- 'Backup your config/gitlab.yml',
+ 'Back-up your config/gitlab.yml',
'Copy config/gitlab.yml.example to config/gitlab.yml',
'Update config/gitlab.yml to match your setup'
)
diff --git a/lib/system_check/app/projects_have_namespace_check.rb b/lib/system_check/app/projects_have_namespace_check.rb
index c70633a6d4f..a6ec9f7665c 100644
--- a/lib/system_check/app/projects_have_namespace_check.rb
+++ b/lib/system_check/app/projects_have_namespace_check.rb
@@ -1,7 +1,7 @@
module SystemCheck
module App
class ProjectsHaveNamespaceCheck < SystemCheck::BaseCheck
- set_name 'projects have namespace: '
+ set_name 'Projects have namespace:'
set_skip_reason "can't check, you have no projects"
def skip?
diff --git a/lib/system_check/app/ruby_version_check.rb b/lib/system_check/app/ruby_version_check.rb
index 37b4d24aa55..fd82f5f8a4a 100644
--- a/lib/system_check/app/ruby_version_check.rb
+++ b/lib/system_check/app/ruby_version_check.rb
@@ -5,7 +5,7 @@ module SystemCheck
set_check_pass -> { "yes (#{self.current_version})" }
def self.required_version
- @required_version ||= Gitlab::VersionInfo.new(2, 1, 0)
+ @required_version ||= Gitlab::VersionInfo.new(2, 3, 3)
end
def self.current_version