No gitolite in project any more

This commit is contained in:
Dmitriy Zaporozhets 2013-02-11 19:16:59 +02:00
parent 8e0b58d7e7
commit d64090b8a9
27 changed files with 117 additions and 159 deletions

View file

@ -1,7 +1,7 @@
namespace :gitlab do
desc "GITLAB | Check the configuration of GitLab and its environment"
task check: %w{gitlab:env:check
gitlab:gitolite:check
gitlab:gitlab_shell:check
gitlab:sidekiq:check
gitlab:app:check}
@ -296,10 +296,10 @@ namespace :gitlab do
# see https://github.com/gitlabhq/gitlabhq/issues/1059
def check_issue_1059_shell_profile_error
gitolite_ssh_user = Gitlab.config.gitolite.ssh_user
print "Has no \"-e\" in ~#{gitolite_ssh_user}/.profile ... "
gitlab_shell_ssh_user = Gitlab.config.gitlab_shell.ssh_user
print "Has no \"-e\" in ~#{gitlab_shell_ssh_user}/.profile ... "
profile_file = File.join(gitolite_user_home, ".profile")
profile_file = File.join(gitlab_shell_user_home, ".profile")
unless File.read(profile_file) =~ /^-e PATH/
puts "yes".green
@ -367,7 +367,7 @@ namespace :gitlab do
namespace :gitolite do
namespace :gitlab_shell do
desc "GITLAB | Check the configuration of Gitolite"
task check: :environment do
warn_user_is_not_gitlab
@ -392,25 +392,25 @@ namespace :gitlab do
print "post-receive hook up-to-date? ... "
hook_file = "post-receive"
gitolite_hooks_path = File.join(Gitlab.config.gitolite.hooks_path, "common")
gitolite_hook_file = File.join(gitolite_hooks_path, hook_file)
gitolite_ssh_user = Gitlab.config.gitolite.ssh_user
gitlab_shell_hooks_path = File.join(Gitlab.config.gitlab_shell.hooks_path, "common")
gitlab_shell_hook_file = File.join(gitlab_shell_hooks_path, hook_file)
gitlab_shell_ssh_user = Gitlab.config.gitlab_shell.ssh_user
unless File.exists?(gitolite_hook_file)
unless File.exists?(gitlab_shell_hook_file)
puts "can't check because of previous errors".magenta
return
end
gitolite_hook_content = File.read(gitolite_hook_file)
gitlab_shell_hook_content = File.read(gitlab_shell_hook_file)
gitlab_hook_file = Rails.root.join.join("lib", "hooks", hook_file)
gitlab_hook_content = File.read(gitlab_hook_file)
if gitolite_hook_content == gitlab_hook_content
if gitlab_shell_hook_content == gitlab_hook_content
puts "yes".green
else
puts "no".red
try_fixing_it(
"sudo -u #{gitolite_ssh_user} cp #{gitlab_hook_file} #{gitolite_hook_file}"
"sudo -u #{gitlab_shell_ssh_user} cp #{gitlab_hook_file} #{gitlab_shell_hook_file}"
)
for_more_information(
see_installation_guide_section "Setup GitLab Hooks"
@ -422,7 +422,7 @@ namespace :gitlab do
def check_repo_base_exists
print "Repo base directory exists? ... "
repo_base_path = Gitlab.config.gitolite.repos_path
repo_base_path = Gitlab.config.gitlab_shell.repos_path
if File.exists?(repo_base_path)
puts "yes".green
@ -444,7 +444,7 @@ namespace :gitlab do
def check_repo_base_is_not_symlink
print "Repo base directory is a symlink? ... "
repo_base_path = Gitlab.config.gitolite.repos_path
repo_base_path = Gitlab.config.gitlab_shell.repos_path
unless File.exists?(repo_base_path)
puts "can't check because of previous errors".magenta
return
@ -464,7 +464,7 @@ namespace :gitlab do
def check_repo_base_permissions
print "Repo base access is drwxrws---? ... "
repo_base_path = Gitlab.config.gitolite.repos_path
repo_base_path = Gitlab.config.gitlab_shell.repos_path
unless File.exists?(repo_base_path)
puts "can't check because of previous errors".magenta
return
@ -487,23 +487,23 @@ namespace :gitlab do
end
def check_repo_base_user_and_group
gitolite_ssh_user = Gitlab.config.gitolite.ssh_user
gitolite_owner_group = Gitlab.config.gitolite.owner_group
print "Repo base owned by #{gitolite_ssh_user}:#{gitolite_owner_group}? ... "
gitlab_shell_ssh_user = Gitlab.config.gitlab_shell.ssh_user
gitlab_shell_owner_group = Gitlab.config.gitlab_shell.owner_group
print "Repo base owned by #{gitlab_shell_ssh_user}:#{gitlab_shell_owner_group}? ... "
repo_base_path = Gitlab.config.gitolite.repos_path
repo_base_path = Gitlab.config.gitlab_shell.repos_path
unless File.exists?(repo_base_path)
puts "can't check because of previous errors".magenta
return
end
if File.stat(repo_base_path).uid == uid_for(gitolite_ssh_user) &&
File.stat(repo_base_path).gid == gid_for(gitolite_owner_group)
if File.stat(repo_base_path).uid == uid_for(gitlab_shell_ssh_user) &&
File.stat(repo_base_path).gid == gid_for(gitlab_shell_owner_group)
puts "yes".green
else
puts "no".red
try_fixing_it(
"sudo chown -R #{gitolite_ssh_user}:#{gitolite_owner_group} #{repo_base_path}"
"sudo chown -R #{gitlab_shell_ssh_user}:#{gitlab_shell_owner_group} #{repo_base_path}"
)
for_more_information(
see_installation_guide_section "Gitolite"
@ -516,11 +516,11 @@ namespace :gitlab do
print "post-receive hooks in repos are links: ... "
hook_file = "post-receive"
gitolite_hooks_path = File.join(Gitlab.config.gitolite.hooks_path, "common")
gitolite_hook_file = File.join(gitolite_hooks_path, hook_file)
gitolite_ssh_user = Gitlab.config.gitolite.ssh_user
gitlab_shell_hooks_path = File.join(Gitlab.config.gitlab_shell.hooks_path, "common")
gitlab_shell_hook_file = File.join(gitlab_shell_hooks_path, hook_file)
gitlab_shell_ssh_user = Gitlab.config.gitlab_shell.ssh_user
unless File.exists?(gitolite_hook_file)
unless File.exists?(gitlab_shell_hook_file)
puts "can't check because of previous errors".magenta
return
end
@ -542,7 +542,7 @@ namespace :gitlab do
unless File.exists?(project_hook_file)
puts "missing".red
try_fixing_it(
"sudo -u #{gitolite_ssh_user} ln -sf #{gitolite_hook_file} #{project_hook_file}"
"sudo -u #{gitlab_shell_ssh_user} ln -sf #{gitlab_shell_hook_file} #{project_hook_file}"
)
for_more_information(
"lib/support/rewrite-hooks.sh"
@ -552,12 +552,12 @@ namespace :gitlab do
end
if File.lstat(project_hook_file).symlink? &&
File.realpath(project_hook_file) == File.realpath(gitolite_hook_file)
File.realpath(project_hook_file) == File.realpath(gitlab_shell_hook_file)
puts "ok".green
else
puts "not a link to Gitolite's hook".red
try_fixing_it(
"sudo -u #{gitolite_ssh_user} ln -sf #{gitolite_hook_file} #{project_hook_file}"
"sudo -u #{gitlab_shell_ssh_user} ln -sf #{gitlab_shell_hook_file} #{project_hook_file}"
)
for_more_information(
"lib/support/rewrite-hooks.sh"
@ -572,19 +572,19 @@ namespace :gitlab do
# Helper methods
########################
def gitolite_user_home
File.expand_path("~#{Gitlab.config.gitolite.ssh_user}")
def gitlab_shell_user_home
File.expand_path("~#{Gitlab.config.gitlab_shell.ssh_user}")
end
def gitolite_version
gitolite_version_file = "#{gitolite_user_home}/gitolite/src/VERSION"
if File.readable?(gitolite_version_file)
File.read(gitolite_version_file)
def gitlab_shell_version
gitlab_shell_version_file = "#{gitlab_shell_user_home}/gitlab_shell/src/VERSION"
if File.readable?(gitlab_shell_version_file)
File.read(gitlab_shell_version_file)
end
end
def has_gitolite3?
gitolite_version.try(:start_with?, "v3.")
def has_gitlab_shell3?
gitlab_shell_version.try(:start_with?, "v3.")
end
end