diff --git a/lib/system_check/helpers.rb b/lib/system_check/helpers.rb index cd54baa494f..c42ae4fe4c4 100644 --- a/lib/system_check/helpers.rb +++ b/lib/system_check/helpers.rb @@ -68,19 +68,8 @@ module SystemCheck Dir.pwd == '/opt/gitlab/embedded/service/gitlab-rails' end - def gitlab_user - Gitlab.config.gitlab.user - end - def sudo_gitlab(command) "sudo -u #{gitlab_user} -H #{command}" end - - def is_gitlab_user? - return @is_gitlab_user unless @is_gitlab_user.nil? - - current_user = run_command(%w(whoami)).chomp - @is_gitlab_user = current_user == gitlab_user - end end end diff --git a/lib/tasks/gitlab/task_helpers.rb b/lib/tasks/gitlab/task_helpers.rb index e2307e41be1..964aa0fe1bc 100644 --- a/lib/tasks/gitlab/task_helpers.rb +++ b/lib/tasks/gitlab/task_helpers.rb @@ -98,6 +98,17 @@ module Gitlab end end + def gitlab_user + Gitlab.config.gitlab.user + end + + def is_gitlab_user? + return @is_gitlab_user unless @is_gitlab_user.nil? + + current_user = run_command(%w(whoami)).chomp + @is_gitlab_user = current_user == gitlab_user + end + def warn_user_is_not_gitlab return if @warned_user_not_gitlab @@ -114,22 +125,6 @@ module Gitlab end end - # 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 - def all_repos Gitlab.config.repositories.storages.each_value do |repository_storage| IO.popen(%W(find #{repository_storage['path']} -mindepth 2 -maxdepth 2 -type d -name *.git)) do |find| diff --git a/spec/lib/system_check_spec.rb b/spec/lib/system_check_spec.rb index d2087ad2d83..01679282f87 100644 --- a/spec/lib/system_check_spec.rb +++ b/spec/lib/system_check_spec.rb @@ -9,10 +9,6 @@ describe SystemCheck, lib: true do end describe '.run' do - it 'requires custom executor to be a BasicExecutor' do - expect { subject.run('Component', [], SystemCheck::SimpleExecutor) }.not_to raise_error - end - context 'custom matcher' do class SimpleCheck < SystemCheck::BaseCheck def check?