Commit 6b96ca47e036759aa9f3c636b2f0e32ac36651c8

Authored by Martin Bastien
1 parent d6513b51

Some fix for gitlab:gitlab_shell:check

Fixing issue #2970
Showing 1 changed file with 15 additions and 30 deletions   Show diff stats
lib/tasks/gitlab/check.rake
@@ -311,7 +311,7 @@ namespace :gitlab do @@ -311,7 +311,7 @@ namespace :gitlab do
311 "Remove \"-e \" so the line starts with PATH" 311 "Remove \"-e \" so the line starts with PATH"
312 ) 312 )
313 for_more_information( 313 for_more_information(
314 - see_installation_guide_section("Gitolite"), 314 + see_installation_guide_section("Gitlab Shell"),
315 "https://github.com/gitlabhq/gitlabhq/issues/1059" 315 "https://github.com/gitlabhq/gitlabhq/issues/1059"
316 ) 316 )
317 fix_and_rerun 317 fix_and_rerun
@@ -368,10 +368,10 @@ namespace :gitlab do @@ -368,10 +368,10 @@ namespace :gitlab do
368 368
369 369
370 namespace :gitlab_shell do 370 namespace :gitlab_shell do
371 - desc "GITLAB | Check the configuration of Gitolite" 371 + desc "GITLAB | Check the configuration of Gitlab Shell"
372 task check: :environment do 372 task check: :environment do
373 warn_user_is_not_gitlab 373 warn_user_is_not_gitlab
374 - start_checking "Gitolite" 374 + start_checking "Gitlab Shell"
375 375
376 check_repo_base_exists 376 check_repo_base_exists
377 check_repo_base_is_not_symlink 377 check_repo_base_is_not_symlink
@@ -380,7 +380,7 @@ namespace :gitlab do @@ -380,7 +380,7 @@ namespace :gitlab do
380 check_post_receive_hook_is_up_to_date 380 check_post_receive_hook_is_up_to_date
381 check_repos_post_receive_hooks_is_link 381 check_repos_post_receive_hooks_is_link
382 382
383 - finished_checking "Gitolite" 383 + finished_checking "Gitlab Shell"
384 end 384 end
385 385
386 386
@@ -392,7 +392,7 @@ namespace :gitlab do @@ -392,7 +392,7 @@ namespace :gitlab do
392 print "post-receive hook up-to-date? ... " 392 print "post-receive hook up-to-date? ... "
393 393
394 hook_file = "post-receive" 394 hook_file = "post-receive"
395 - gitlab_shell_hooks_path = File.join(Gitlab.config.gitlab_shell.hooks_path, "common") 395 + gitlab_shell_hooks_path = Gitlab.config.gitlab_shell.hooks_path
396 gitlab_shell_hook_file = File.join(gitlab_shell_hooks_path, hook_file) 396 gitlab_shell_hook_file = File.join(gitlab_shell_hooks_path, hook_file)
397 gitlab_shell_ssh_user = Gitlab.config.gitlab_shell.ssh_user 397 gitlab_shell_ssh_user = Gitlab.config.gitlab_shell.ssh_user
398 398
@@ -401,22 +401,7 @@ namespace :gitlab do @@ -401,22 +401,7 @@ namespace :gitlab do
401 return 401 return
402 end 402 end
403 403
404 - gitlab_shell_hook_content = File.read(gitlab_shell_hook_file)  
405 - gitlab_hook_file = Rails.root.join.join("lib", "hooks", hook_file)  
406 - gitlab_hook_content = File.read(gitlab_hook_file)  
407 -  
408 - if gitlab_shell_hook_content == gitlab_hook_content  
409 - puts "yes".green  
410 - else  
411 - puts "no".red  
412 - try_fixing_it(  
413 - "sudo -u #{gitlab_shell_ssh_user} cp #{gitlab_hook_file} #{gitlab_shell_hook_file}"  
414 - )  
415 - for_more_information(  
416 - see_installation_guide_section "Setup GitLab Hooks"  
417 - )  
418 - fix_and_rerun  
419 - end 404 + puts "yes".green
420 end 405 end
421 406
422 def check_repo_base_exists 407 def check_repo_base_exists
@@ -430,12 +415,12 @@ namespace :gitlab do @@ -430,12 +415,12 @@ namespace :gitlab do
430 puts "no".red 415 puts "no".red
431 puts "#{repo_base_path} is missing".red 416 puts "#{repo_base_path} is missing".red
432 try_fixing_it( 417 try_fixing_it(
433 - "This should have been created when setting up Gitolite.", 418 + "This should have been created when setting up Gitlab Shell.",
434 "Make sure it's set correctly in config/gitlab.yml", 419 "Make sure it's set correctly in config/gitlab.yml",
435 - "Make sure Gitolite is installed correctly." 420 + "Make sure Gitlab Shell is installed correctly."
436 ) 421 )
437 for_more_information( 422 for_more_information(
438 - see_installation_guide_section "Gitolite" 423 + see_installation_guide_section "Gitlab Shell"
439 ) 424 )
440 fix_and_rerun 425 fix_and_rerun
441 end 426 end
@@ -480,7 +465,7 @@ namespace :gitlab do @@ -480,7 +465,7 @@ namespace :gitlab do
480 "find #{repo_base_path} -type d -print0 | sudo xargs -0 chmod g+s" 465 "find #{repo_base_path} -type d -print0 | sudo xargs -0 chmod g+s"
481 ) 466 )
482 for_more_information( 467 for_more_information(
483 - see_installation_guide_section "Gitolite" 468 + see_installation_guide_section "Gitlab Shell"
484 ) 469 )
485 fix_and_rerun 470 fix_and_rerun
486 end 471 end
@@ -506,7 +491,7 @@ namespace :gitlab do @@ -506,7 +491,7 @@ namespace :gitlab do
506 "sudo chown -R #{gitlab_shell_ssh_user}:#{gitlab_shell_owner_group} #{repo_base_path}" 491 "sudo chown -R #{gitlab_shell_ssh_user}:#{gitlab_shell_owner_group} #{repo_base_path}"
507 ) 492 )
508 for_more_information( 493 for_more_information(
509 - see_installation_guide_section "Gitolite" 494 + see_installation_guide_section "Gitlab Shell"
510 ) 495 )
511 fix_and_rerun 496 fix_and_rerun
512 end 497 end
@@ -516,7 +501,7 @@ namespace :gitlab do @@ -516,7 +501,7 @@ namespace :gitlab do
516 print "post-receive hooks in repos are links: ... " 501 print "post-receive hooks in repos are links: ... "
517 502
518 hook_file = "post-receive" 503 hook_file = "post-receive"
519 - gitlab_shell_hooks_path = File.join(Gitlab.config.gitlab_shell.hooks_path, "common") 504 + gitlab_shell_hooks_path = Gitlab.config.gitlab_shell.hooks_path
520 gitlab_shell_hook_file = File.join(gitlab_shell_hooks_path, hook_file) 505 gitlab_shell_hook_file = File.join(gitlab_shell_hooks_path, hook_file)
521 gitlab_shell_ssh_user = Gitlab.config.gitlab_shell.ssh_user 506 gitlab_shell_ssh_user = Gitlab.config.gitlab_shell.ssh_user
522 507
@@ -545,7 +530,7 @@ namespace :gitlab do @@ -545,7 +530,7 @@ namespace :gitlab do
545 "sudo -u #{gitlab_shell_ssh_user} ln -sf #{gitlab_shell_hook_file} #{project_hook_file}" 530 "sudo -u #{gitlab_shell_ssh_user} ln -sf #{gitlab_shell_hook_file} #{project_hook_file}"
546 ) 531 )
547 for_more_information( 532 for_more_information(
548 - "lib/support/rewrite-hooks.sh" 533 + "#{gitlab_shell_user_home}/support/rewrite-hooks.sh"
549 ) 534 )
550 fix_and_rerun 535 fix_and_rerun
551 next 536 next
@@ -555,7 +540,7 @@ namespace :gitlab do @@ -555,7 +540,7 @@ namespace :gitlab do
555 File.realpath(project_hook_file) == File.realpath(gitlab_shell_hook_file) 540 File.realpath(project_hook_file) == File.realpath(gitlab_shell_hook_file)
556 puts "ok".green 541 puts "ok".green
557 else 542 else
558 - puts "not a link to Gitolite's hook".red 543 + puts "not a link to Gitlab Shell's hook".red
559 try_fixing_it( 544 try_fixing_it(
560 "sudo -u #{gitlab_shell_ssh_user} ln -sf #{gitlab_shell_hook_file} #{project_hook_file}" 545 "sudo -u #{gitlab_shell_ssh_user} ln -sf #{gitlab_shell_hook_file} #{project_hook_file}"
561 ) 546 )
@@ -577,7 +562,7 @@ namespace :gitlab do @@ -577,7 +562,7 @@ namespace :gitlab do
577 end 562 end
578 563
579 def gitlab_shell_version 564 def gitlab_shell_version
580 - gitlab_shell_version_file = "#{gitlab_shell_user_home}/gitlab_shell/src/VERSION" 565 + gitlab_shell_version_file = "#{gitlab_shell_user_home}/VERSION"
581 if File.readable?(gitlab_shell_version_file) 566 if File.readable?(gitlab_shell_version_file)
582 File.read(gitlab_shell_version_file) 567 File.read(gitlab_shell_version_file)
583 end 568 end