Skip to content
Snippets Groups Projects
Commit 0e2880b7 authored by Riyad Preukschas's avatar Riyad Preukschas
Browse files

Backport fixes to the check and info tasks

parent 10b312ab
No related branches found
No related tags found
2 merge requests!104094 0 stable,!2553Wiki grammar patch
Loading
Loading
@@ -89,6 +89,7 @@ backup:
## Gitolite settings
gitolite:
admin_uri: git@localhost:gitolite-admin
# repos_path must not be a symlink
repos_path: /home/git/repositories/
hooks_path: /home/git/.gitolite/hooks/
admin_key: gitlab
Loading
Loading
Loading
Loading
@@ -48,7 +48,7 @@ namespace :gitlab do
see_database_guide,
"http://guides.rubyonrails.org/getting_started.html#configuring-a-database"
)
check_failed
fix_and_rerun
end
end
 
Loading
Loading
@@ -65,7 +65,7 @@ namespace :gitlab do
"https://github.com/gitlabhq/gitlabhq/wiki/Migrate-from-SQLite-to-MySQL",
see_database_guide
)
check_failed
fix_and_rerun
end
end
 
Loading
Loading
@@ -85,7 +85,7 @@ namespace :gitlab do
for_more_information(
see_installation_guide_section "GitLab"
)
check_failed
fix_and_rerun
end
end
 
Loading
Loading
@@ -98,7 +98,7 @@ namespace :gitlab do
end
 
# omniauth or ldap could have been deleted from the file
unless Gitlab.config.pre_40_config
unless Gitlab.config['git_host']
puts "no".green
else
puts "yes".red
Loading
Loading
@@ -110,7 +110,7 @@ namespace :gitlab do
for_more_information(
see_installation_guide_section "GitLab"
)
check_failed
fix_and_rerun
end
end
 
Loading
Loading
@@ -129,7 +129,7 @@ namespace :gitlab do
for_more_information(
see_installation_guide_section "Install Init Script"
)
check_failed
fix_and_rerun
end
end
 
Loading
Loading
@@ -155,7 +155,7 @@ namespace :gitlab do
for_more_information(
see_installation_guide_section "Install Init Script"
)
check_failed
fix_and_rerun
end
end
 
Loading
Loading
@@ -171,7 +171,7 @@ namespace :gitlab do
try_fixing_it(
"sudo -u gitlab -H bundle exec rake db:migrate"
)
check_failed
fix_and_rerun
end
end
 
Loading
Loading
@@ -201,7 +201,7 @@ namespace :gitlab do
for_more_information(
"doc/raketasks/maintenance.md "
)
check_failed
fix_and_rerun
end
end
end
Loading
Loading
@@ -222,7 +222,7 @@ namespace :gitlab do
for_more_information(
see_installation_guide_section "GitLab"
)
check_failed
fix_and_rerun
end
end
 
Loading
Loading
@@ -242,7 +242,7 @@ namespace :gitlab do
for_more_information(
see_installation_guide_section "GitLab"
)
check_failed
fix_and_rerun
end
end
end
Loading
Loading
@@ -256,7 +256,7 @@ namespace :gitlab do
start_checking "Environment"
 
check_gitlab_in_git_group
check_issue_1056_shell_profile_error
check_issue_1059_shell_profile_error
check_gitlab_git_config
check_python2_exists
check_python2_version
Loading
Loading
@@ -290,7 +290,7 @@ namespace :gitlab do
for_more_information(
see_installation_guide_section "GitLab"
)
check_failed
fix_and_rerun
end
end
 
Loading
Loading
@@ -308,12 +308,12 @@ namespace :gitlab do
for_more_information(
see_installation_guide_section "System Users"
)
check_failed
fix_and_rerun
end
end
 
# see https://github.com/gitlabhq/gitlabhq/issues/1059
def check_issue_1056_shell_profile_error
def check_issue_1059_shell_profile_error
gitolite_ssh_user = Gitlab.config.gitolite.ssh_user
print "Has no \"-e\" in ~#{gitolite_ssh_user}/.profile ... "
 
Loading
Loading
@@ -332,7 +332,7 @@ namespace :gitlab do
see_installation_guide_section("Gitolite"),
"https://github.com/gitlabhq/gitlabhq/issues/1059"
)
check_failed
fix_and_rerun
end
end
 
Loading
Loading
@@ -352,7 +352,7 @@ namespace :gitlab do
for_more_information(
see_installation_guide_section "Packages / Dependencies"
)
check_failed
fix_and_rerun
end
end
 
Loading
Loading
@@ -378,7 +378,7 @@ namespace :gitlab do
for_more_information(
see_installation_guide_section "Packages / Dependencies"
)
check_failed
fix_and_rerun
end
end
end
Loading
Loading
@@ -398,6 +398,7 @@ namespace :gitlab do
check_dot_gitolite_user_and_group
check_dot_gitolite_permissions
check_repo_base_exists
check_repo_base_is_not_symlink
check_repo_base_user_and_group
check_repo_base_permissions
check_can_clone_gitolite_admin
Loading
Loading
@@ -434,7 +435,7 @@ namespace :gitlab do
for_more_information(
see_installation_guide_section "Gitolite"
)
check_failed
fix_and_rerun
end
 
# assumes #check_can_clone_gitolite_admin has been run before
Loading
Loading
@@ -466,7 +467,7 @@ namespace :gitlab do
for_more_information(
see_installation_guide_section "Gitolite"
)
check_failed
fix_and_rerun
ensure
FileUtils.rm_rf("/tmp/gitolite_gitlab_test")
end
Loading
Loading
@@ -488,7 +489,7 @@ namespace :gitlab do
for_more_information(
see_installation_guide_section "Gitolite"
)
check_failed
fix_and_rerun
end
end
 
Loading
Loading
@@ -511,7 +512,7 @@ namespace :gitlab do
for_more_information(
see_installation_guide_section "Gitolite"
)
check_failed
fix_and_rerun
end
end
 
Loading
Loading
@@ -537,13 +538,13 @@ namespace :gitlab do
for_more_information(
see_installation_guide_section "Gitolite"
)
check_failed
fix_and_rerun
end
end
 
def check_gitolite_is_up_to_date
print "Using recommended version ... "
if gitolite_version.try(:start_with?, "v3.04")
if gitolite_version.try(:start_with?, "v3.2")
puts "yes".green
else
puts "no".red
Loading
Loading
@@ -582,7 +583,7 @@ namespace :gitlab do
for_more_information(
see_installation_guide_section "Gitolite"
)
check_failed
fix_and_rerun
end
end
 
Loading
Loading
@@ -611,7 +612,7 @@ namespace :gitlab do
for_more_information(
see_installation_guide_section "Gitolite"
)
check_failed
fix_and_rerun
end
end
 
Loading
Loading
@@ -635,7 +636,7 @@ namespace :gitlab do
for_more_information(
see_installation_guide_section "Setup GitLab Hooks"
)
check_failed
fix_and_rerun
end
end
 
Loading
Loading
@@ -666,7 +667,7 @@ namespace :gitlab do
for_more_information(
see_installation_guide_section "Setup GitLab Hooks"
)
check_failed
fix_and_rerun
end
end
 
Loading
Loading
@@ -688,7 +689,27 @@ namespace :gitlab do
for_more_information(
see_installation_guide_section "Gitolite"
)
check_failed
fix_and_rerun
end
end
def check_repo_base_is_not_symlink
print "Repo base directory is a symlink? ... "
repo_base_path = Gitlab.config.gitolite.repos_path
unless File.exists?(repo_base_path)
puts "can't check because of previous errors".magenta
return
end
unless File.symlink?(repo_base_path)
puts "no".green
else
puts "yes".red
try_fixing_it(
"Make sure it's set to the real directory in config/gitlab.yml"
)
fix_and_rerun
end
end
 
Loading
Loading
@@ -712,7 +733,7 @@ namespace :gitlab do
for_more_information(
see_installation_guide_section "Gitolite"
)
check_failed
fix_and_rerun
end
end
 
Loading
Loading
@@ -738,7 +759,7 @@ namespace :gitlab do
for_more_information(
see_installation_guide_section "Gitolite"
)
check_failed
fix_and_rerun
end
end
 
Loading
Loading
@@ -772,7 +793,7 @@ namespace :gitlab do
for_more_information(
"doc/raketasks/maintenance.md"
)
check_failed
fix_and_rerun
end
end
end
Loading
Loading
@@ -808,7 +829,7 @@ namespace :gitlab do
for_more_information(
"lib/support/rewrite-hooks.sh"
)
check_failed
fix_and_rerun
next
end
 
Loading
Loading
@@ -822,7 +843,7 @@ namespace :gitlab do
for_more_information(
"lib/support/rewrite-hooks.sh"
)
check_failed
fix_and_rerun
end
end
end
Loading
Loading
@@ -880,7 +901,7 @@ namespace :gitlab do
see_installation_guide_section("Install Init Script"),
"see log/resque.log for possible errors"
)
check_failed
fix_and_rerun
end
end
end
Loading
Loading
@@ -889,7 +910,7 @@ namespace :gitlab do
# Helper methods
##########################
 
def check_failed
def fix_and_rerun
puts " Please #{"fix the error above"} and rerun the checks.".red
end
 
Loading
Loading
@@ -908,29 +929,6 @@ namespace :gitlab do
puts ""
end
 
# Runs the given command
#
# Returns nil if the command was not found
# Returns the output of the command otherwise
#
# see also #run_and_match
def run(command)
unless `#{command} 2>/dev/null`.blank?
`#{command}`
end
end
# Runs the given command and matches the output agains the given pattern
#
# Returns nil if nothing matched
# Retunrs the MatchData if the pattern matched
#
# see also #run
# see also String#match
def run_and_match(command, pattern)
run(command).try(:match, pattern)
end
def see_database_guide
"doc/install/databases.md"
end
Loading
Loading
@@ -952,18 +950,4 @@ namespace :gitlab do
puts " #{step}"
end
end
def warn_user_is_not_gitlab
unless @warned_user_not_gitlab
current_user = run("whoami").chomp
unless current_user == "gitlab"
puts "#{Colored.color(:black)+Colored.color(:on_yellow)} Warning #{Colored.extra(:clear)}"
puts " You are running as user #{current_user.magenta}, we hope you know what you are doing."
puts " Some tests may pass\/fail for the wrong reason."
puts " For meaningful results you should run this as user #{"gitlab".magenta}."
puts ""
end
@warned_user_not_gitlab = true
end
end
end
Loading
Loading
@@ -12,7 +12,10 @@ namespace :gitlab do
debian_version = File.read('/etc/debian_version')
"Debian #{debian_version}"
end
os_name.squish!
os_name ||= if File.readable?('/etc/SuSE-release')
File.read('/etc/SuSE-release')
end
os_name.try(:squish!)
 
# check if there is an RVM environment
rvm_version = run_and_match("rvm --version", /[\d\.]+/).try(:to_s)
Loading
Loading
@@ -80,31 +83,5 @@ namespace :gitlab do
puts "Git:\t\t#{Gitlab.config.git.bin_path}"
 
end
# Helper methods
# Runs the given command and matches the output agains the given pattern
#
# Returns nil if nothing matched
# Retunrs the MatchData if the pattern matched
#
# see also #run
# see also String#match
def run_and_match(command, regexp)
run(command).try(:match, regexp)
end
# Runs the given command
#
# Returns nil if the command was not found
# Returns the output of the command otherwise
#
# see also #run_and_match
def run(command)
unless `#{command} 2>/dev/null`.blank?
`#{command}`
end
end
end
end
namespace :gitlab do
# Runs the given command and matches the output agains the given pattern
#
# Returns nil if nothing matched
# Retunrs the MatchData if the pattern matched
#
# see also #run
# see also String#match
def run_and_match(command, regexp)
run(command).try(:match, regexp)
end
# Runs the given command
#
# Returns nil if the command was not found
# Returns the output of the command otherwise
#
# see also #run_and_match
def run(command)
unless `#{command} 2>/dev/null`.blank?
`#{command}`
end
end
def warn_user_is_not_gitlab
unless @warned_user_not_gitlab
current_user = run("whoami").chomp
unless current_user == "gitlab"
puts "#{Colored.color(:black)+Colored.color(:on_yellow)} Warning #{Colored.extra(:clear)}"
puts " You are running as user #{current_user.magenta}, we hope you know what you are doing."
puts " Things may work\/fail for the wrong reasons."
puts " For correct results you should run this as user #{"gitlab".magenta}."
puts ""
end
@warned_user_not_gitlab = true
end
end
end
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment