Commit b5f116f08bfd02f87b819411f89d93c711411c90

Authored by Riyad Preukschas
1 parent b7314a16

Add a check whether repos_path is a symlink

config/gitlab.yml.example
@@ -92,6 +92,7 @@ backup: @@ -92,6 +92,7 @@ backup:
92 ## Gitolite settings 92 ## Gitolite settings
93 gitolite: 93 gitolite:
94 admin_uri: git@localhost:gitolite-admin 94 admin_uri: git@localhost:gitolite-admin
  95 + # repos_path must not be a symlink
95 repos_path: /home/git/repositories/ 96 repos_path: /home/git/repositories/
96 hooks_path: /home/git/.gitolite/hooks/ 97 hooks_path: /home/git/.gitolite/hooks/
97 admin_key: gitlab 98 admin_key: gitlab
lib/tasks/gitlab/check.rake
@@ -398,6 +398,7 @@ namespace :gitlab do @@ -398,6 +398,7 @@ namespace :gitlab do
398 check_dot_gitolite_user_and_group 398 check_dot_gitolite_user_and_group
399 check_dot_gitolite_permissions 399 check_dot_gitolite_permissions
400 check_repo_base_exists 400 check_repo_base_exists
  401 + check_repo_base_is_not_symlink
401 check_repo_base_user_and_group 402 check_repo_base_user_and_group
402 check_repo_base_permissions 403 check_repo_base_permissions
403 check_can_clone_gitolite_admin 404 check_can_clone_gitolite_admin
@@ -692,6 +693,26 @@ namespace :gitlab do @@ -692,6 +693,26 @@ namespace :gitlab do
692 end 693 end
693 end 694 end
694 695
  696 + def check_repo_base_is_not_symlink
  697 + print "Repo base directory is a symlink? ... "
  698 +
  699 + repo_base_path = Gitlab.config.gitolite.repos_path
  700 + unless File.exists?(repo_base_path)
  701 + puts "can't check because of previous errors".magenta
  702 + return
  703 + end
  704 +
  705 + unless File.symlink?(repo_base_path)
  706 + puts "no".green
  707 + else
  708 + puts "yes".red
  709 + try_fixing_it(
  710 + "Make sure it's set to the real directory in config/gitlab.yml"
  711 + )
  712 + fix_and_rerun
  713 + end
  714 + end
  715 +
695 def check_repo_base_permissions 716 def check_repo_base_permissions
696 print "Repo base access is drwsrws---? ... " 717 print "Repo base access is drwsrws---? ... "
697 718