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:
authorGitLab Bot <gitlab-bot@gitlab.com>2022-02-18 12:45:46 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2022-02-18 12:45:46 +0300
commita7b3560714b4d9cc4ab32dffcd1f74a284b93580 (patch)
tree7452bd5c3545c2fa67a28aa013835fb4fa071baf /lib/system_check
parentee9173579ae56a3dbfe5afe9f9410c65bb327ca7 (diff)
Add latest changes from gitlab-org/gitlab@14-8-stable-eev14.8.0-rc42
Diffstat (limited to 'lib/system_check')
-rw-r--r--lib/system_check/app/git_config_check.rb44
-rw-r--r--lib/system_check/app/git_version_check.rb31
-rw-r--r--lib/system_check/orphans/repository_check.rb4
-rw-r--r--lib/system_check/rake_task/app_task.rb2
4 files changed, 2 insertions, 79 deletions
diff --git a/lib/system_check/app/git_config_check.rb b/lib/system_check/app/git_config_check.rb
deleted file mode 100644
index d0b64b8bfeb..00000000000
--- a/lib/system_check/app/git_config_check.rb
+++ /dev/null
@@ -1,44 +0,0 @@
-# frozen_string_literal: true
-
-module SystemCheck
- module App
- class GitConfigCheck < SystemCheck::BaseCheck
- OPTIONS = {
- 'core.autocrlf' => 'input'
- }.freeze
-
- set_name 'Git configured correctly?'
-
- def check?
- correct_options = OPTIONS.map do |name, value|
- run_command(%W(#{Gitlab.config.git.bin_path} config --global --get #{name})).try(:squish) == value
- end
-
- 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!
- return false unless 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
- try_fixing_it(
- sudo_gitlab("\"#{Gitlab.config.git.bin_path}\" config --global core.autocrlf \"#{OPTIONS['core.autocrlf']}\"")
- )
- for_more_information(
- see_installation_guide_section('GitLab')
- )
- end
- end
- end
-end
diff --git a/lib/system_check/app/git_version_check.rb b/lib/system_check/app/git_version_check.rb
deleted file mode 100644
index 6512b142969..00000000000
--- a/lib/system_check/app/git_version_check.rb
+++ /dev/null
@@ -1,31 +0,0 @@
-# frozen_string_literal: true
-
-module SystemCheck
- module App
- class GitVersionCheck < SystemCheck::BaseCheck
- set_name -> { "Git version >= #{self.required_version} ?" }
- set_check_pass -> { "yes (#{self.current_version})" }
-
- def self.required_version
- @required_version ||= Gitlab::VersionInfo.parse('2.33.0')
- end
-
- def self.current_version
- @current_version ||= Gitlab::VersionInfo.parse(Gitlab::TaskHelpers.run_command(%W(#{Gitlab.config.git.bin_path} --version)))
- end
-
- def check?
- self.class.current_version.valid? && self.class.required_version <= self.class.current_version
- end
-
- def show_error
- $stdout.puts "Your git bin path is \"#{Gitlab.config.git.bin_path}\""
-
- try_fixing_it(
- "Update your git to a version >= #{self.class.required_version} from #{self.class.current_version}"
- )
- fix_and_rerun
- end
- end
- end
-end
diff --git a/lib/system_check/orphans/repository_check.rb b/lib/system_check/orphans/repository_check.rb
index 33020417e95..8f15872de22 100644
--- a/lib/system_check/orphans/repository_check.rb
+++ b/lib/system_check/orphans/repository_check.rb
@@ -57,8 +57,8 @@ module SystemCheck
WHERE (p.repository_storage LIKE ?)
"
- query = ActiveRecord::Base.send(:sanitize_sql_array, [sql, storage_name]) # rubocop:disable GitlabSecurity/PublicSend
- ActiveRecord::Base.connection.select_all(query).rows.try(:flatten!) || []
+ query = ::Project.sanitize_sql_array([sql, storage_name])
+ ::Project.connection.select_all(query).rows.try(:flatten!) || []
end
def fetch_disk_namespaces(storage_path)
diff --git a/lib/system_check/rake_task/app_task.rb b/lib/system_check/rake_task/app_task.rb
index 892417d67ec..1eb7a35b40a 100644
--- a/lib/system_check/rake_task/app_task.rb
+++ b/lib/system_check/rake_task/app_task.rb
@@ -12,7 +12,6 @@ module SystemCheck
def self.checks
[
- SystemCheck::App::GitConfigCheck,
SystemCheck::App::DatabaseConfigExistsCheck,
SystemCheck::App::MigrationsAreUpCheck,
SystemCheck::App::OrphanedGroupMembersCheck,
@@ -28,7 +27,6 @@ module SystemCheck
SystemCheck::App::ProjectsHaveNamespaceCheck,
SystemCheck::App::RedisVersionCheck,
SystemCheck::App::RubyVersionCheck,
- SystemCheck::App::GitVersionCheck,
SystemCheck::App::GitUserDefaultSSHConfigCheck,
SystemCheck::App::ActiveUsersCheck,
SystemCheck::App::AuthorizedKeysPermissionCheck,