Commit a404c43805cf6256f80dad6247a16db257a42d17
1 parent
38737079
Exists in
master
and in
4 other branches
removing outdated checks
Showing
1 changed file
with
0 additions
and
229 deletions
Show diff stats
lib/tasks/gitlab/check.rake
@@ -255,7 +255,6 @@ namespace :gitlab do | @@ -255,7 +255,6 @@ namespace :gitlab do | ||
255 | warn_user_is_not_gitlab | 255 | warn_user_is_not_gitlab |
256 | start_checking "Environment" | 256 | start_checking "Environment" |
257 | 257 | ||
258 | - check_gitlab_in_git_group | ||
259 | check_issue_1059_shell_profile_error | 258 | check_issue_1059_shell_profile_error |
260 | check_gitlab_git_config | 259 | check_gitlab_git_config |
261 | check_python2_exists | 260 | check_python2_exists |
@@ -295,25 +294,6 @@ namespace :gitlab do | @@ -295,25 +294,6 @@ namespace :gitlab do | ||
295 | end | 294 | end |
296 | end | 295 | end |
297 | 296 | ||
298 | - def check_gitlab_in_git_group | ||
299 | - gitlab_user = Gitlab.config.gitlab.user | ||
300 | - gitolite_owner_group = Gitlab.config.gitolite.owner_group | ||
301 | - print "#{gitlab_user} user is in #{gitolite_owner_group} group? ... " | ||
302 | - | ||
303 | - if run_and_match("id -rnG", /^#{gitolite_owner_group}\W|\W#{gitolite_owner_group}\W|\W#{gitolite_owner_group}$/) | ||
304 | - puts "yes".green | ||
305 | - else | ||
306 | - puts "no".red | ||
307 | - try_fixing_it( | ||
308 | - "sudo usermod -a -G #{gitolite_owner_group} #{gitlab_user}" | ||
309 | - ) | ||
310 | - for_more_information( | ||
311 | - see_installation_guide_section "System Users" | ||
312 | - ) | ||
313 | - fix_and_rerun | ||
314 | - end | ||
315 | - end | ||
316 | - | ||
317 | # see https://github.com/gitlabhq/gitlabhq/issues/1059 | 297 | # see https://github.com/gitlabhq/gitlabhq/issues/1059 |
318 | def check_issue_1059_shell_profile_error | 298 | def check_issue_1059_shell_profile_error |
319 | gitolite_ssh_user = Gitlab.config.gitolite.ssh_user | 299 | gitolite_ssh_user = Gitlab.config.gitolite.ssh_user |
@@ -393,18 +373,10 @@ namespace :gitlab do | @@ -393,18 +373,10 @@ namespace :gitlab do | ||
393 | warn_user_is_not_gitlab | 373 | warn_user_is_not_gitlab |
394 | start_checking "Gitolite" | 374 | start_checking "Gitolite" |
395 | 375 | ||
396 | - check_gitolite_is_up_to_date | ||
397 | - check_gitoliterc_repo_umask | ||
398 | - check_gitoliterc_git_config_keys | ||
399 | - check_dot_gitolite_exists | ||
400 | - check_dot_gitolite_user_and_group | ||
401 | - check_dot_gitolite_permissions | ||
402 | check_repo_base_exists | 376 | check_repo_base_exists |
403 | check_repo_base_is_not_symlink | 377 | check_repo_base_is_not_symlink |
404 | check_repo_base_user_and_group | 378 | check_repo_base_user_and_group |
405 | check_repo_base_permissions | 379 | check_repo_base_permissions |
406 | - check_can_clone_gitolite_admin | ||
407 | - check_can_commit_to_gitolite_admin | ||
408 | check_post_receive_hook_exists | 380 | check_post_receive_hook_exists |
409 | check_post_receive_hook_is_up_to_date | 381 | check_post_receive_hook_is_up_to_date |
410 | check_repos_post_receive_hooks_is_link | 382 | check_repos_post_receive_hooks_is_link |
@@ -417,207 +389,6 @@ namespace :gitlab do | @@ -417,207 +389,6 @@ namespace :gitlab do | ||
417 | # Checks | 389 | # Checks |
418 | ######################## | 390 | ######################## |
419 | 391 | ||
420 | - def check_can_clone_gitolite_admin | ||
421 | - print "Can clone gitolite-admin? ... " | ||
422 | - | ||
423 | - test_path = "/tmp/gitlab_gitolite_admin_test" | ||
424 | - FileUtils.rm_rf(test_path) | ||
425 | - `git clone -q #{Gitlab.config.gitolite.admin_uri} #{test_path}` | ||
426 | - raise unless $?.success? | ||
427 | - | ||
428 | - puts "yes".green | ||
429 | - rescue | ||
430 | - puts "no".red | ||
431 | - try_fixing_it( | ||
432 | - "Make sure the \"admin_uri\" is set correctly in config/gitlab.yml", | ||
433 | - "Try cloning it yourself with:", | ||
434 | - " git clone -q #{Gitlab.config.gitolite.admin_uri} /tmp/gitolite-admin", | ||
435 | - "Make sure Gitolite is installed correctly." | ||
436 | - ) | ||
437 | - for_more_information( | ||
438 | - see_installation_guide_section "Gitolite" | ||
439 | - ) | ||
440 | - fix_and_rerun | ||
441 | - end | ||
442 | - | ||
443 | - # assumes #check_can_clone_gitolite_admin has been run before | ||
444 | - def check_can_commit_to_gitolite_admin | ||
445 | - print "Can commit to gitolite-admin? ... " | ||
446 | - | ||
447 | - test_path = "/tmp/gitlab_gitolite_admin_test" | ||
448 | - unless File.exists?(test_path) | ||
449 | - puts "can't check because of previous errors".magenta | ||
450 | - return | ||
451 | - end | ||
452 | - | ||
453 | - Dir.chdir(test_path) do | ||
454 | - `touch foo && git add foo && git commit -qm foo` | ||
455 | - raise unless $?.success? | ||
456 | - end | ||
457 | - | ||
458 | - puts "yes".green | ||
459 | - rescue | ||
460 | - puts "no".red | ||
461 | - try_fixing_it( | ||
462 | - "Try committing to it yourself with:", | ||
463 | - " git clone -q #{Gitlab.config.gitolite.admin_uri} /tmp/gitolite-admin", | ||
464 | - " touch foo", | ||
465 | - " git add foo", | ||
466 | - " git commit -m \"foo\"", | ||
467 | - "Make sure Gitolite is installed correctly." | ||
468 | - ) | ||
469 | - for_more_information( | ||
470 | - see_installation_guide_section "Gitolite" | ||
471 | - ) | ||
472 | - fix_and_rerun | ||
473 | - ensure | ||
474 | - FileUtils.rm_rf("/tmp/gitolite_gitlab_test") | ||
475 | - end | ||
476 | - | ||
477 | - def check_dot_gitolite_exists | ||
478 | - print "Config directory exists? ... " | ||
479 | - | ||
480 | - gitolite_config_path = File.join(gitolite_user_home, ".gitolite") | ||
481 | - | ||
482 | - if File.directory?(gitolite_config_path) | ||
483 | - puts "yes".green | ||
484 | - else | ||
485 | - puts "no".red | ||
486 | - puts "#{gitolite_config_path} is missing".red | ||
487 | - try_fixing_it( | ||
488 | - "This should have been created when setting up Gitolite.", | ||
489 | - "Make sure Gitolite is installed correctly." | ||
490 | - ) | ||
491 | - for_more_information( | ||
492 | - see_installation_guide_section "Gitolite" | ||
493 | - ) | ||
494 | - fix_and_rerun | ||
495 | - end | ||
496 | - end | ||
497 | - | ||
498 | - def check_dot_gitolite_permissions | ||
499 | - print "Config directory access is drwxr-x---? ... " | ||
500 | - | ||
501 | - gitolite_config_path = File.join(gitolite_user_home, ".gitolite") | ||
502 | - unless File.exists?(gitolite_config_path) | ||
503 | - puts "can't check because of previous errors".magenta | ||
504 | - return | ||
505 | - end | ||
506 | - | ||
507 | - if File.stat(gitolite_config_path).mode.to_s(8).ends_with?("750") | ||
508 | - puts "yes".green | ||
509 | - else | ||
510 | - puts "no".red | ||
511 | - try_fixing_it( | ||
512 | - "sudo chmod 750 #{gitolite_config_path}" | ||
513 | - ) | ||
514 | - for_more_information( | ||
515 | - see_installation_guide_section "Gitolite" | ||
516 | - ) | ||
517 | - fix_and_rerun | ||
518 | - end | ||
519 | - end | ||
520 | - | ||
521 | - def check_dot_gitolite_user_and_group | ||
522 | - gitolite_ssh_user = Gitlab.config.gitolite.ssh_user | ||
523 | - gitolite_owner_group = Gitlab.config.gitolite.owner_group | ||
524 | - print "Config directory owned by #{gitolite_ssh_user}:#{gitolite_owner_group} ... " | ||
525 | - | ||
526 | - gitolite_config_path = File.join(gitolite_user_home, ".gitolite") | ||
527 | - unless File.exists?(gitolite_config_path) | ||
528 | - puts "can't check because of previous errors".magenta | ||
529 | - return | ||
530 | - end | ||
531 | - | ||
532 | - if File.stat(gitolite_config_path).uid == uid_for(gitolite_ssh_user) && | ||
533 | - File.stat(gitolite_config_path).gid == gid_for(gitolite_owner_group) | ||
534 | - puts "yes".green | ||
535 | - else | ||
536 | - puts "no".red | ||
537 | - try_fixing_it( | ||
538 | - "sudo chown -R #{gitolite_ssh_user}:#{gitolite_owner_group} #{gitolite_config_path}" | ||
539 | - ) | ||
540 | - for_more_information( | ||
541 | - see_installation_guide_section "Gitolite" | ||
542 | - ) | ||
543 | - fix_and_rerun | ||
544 | - end | ||
545 | - end | ||
546 | - | ||
547 | - def check_gitolite_is_up_to_date | ||
548 | - print "Using recommended version ... " | ||
549 | - if gitolite_version.try(:start_with?, "v3.2") | ||
550 | - puts "yes".green | ||
551 | - else | ||
552 | - puts "no".red | ||
553 | - try_fixing_it( | ||
554 | - "We strongly recommend using the version pointed out in the installation guide." | ||
555 | - ) | ||
556 | - for_more_information( | ||
557 | - see_installation_guide_section "Gitolite" | ||
558 | - ) | ||
559 | - # this is not a "hard" failure | ||
560 | - end | ||
561 | - end | ||
562 | - | ||
563 | - def check_gitoliterc_git_config_keys | ||
564 | - gitoliterc_path = File.join(gitolite_user_home, ".gitolite.rc") | ||
565 | - | ||
566 | - print "Allow all Git config keys in .gitolite.rc ... " | ||
567 | - option_name = if has_gitolite3? | ||
568 | - # see https://github.com/sitaramc/gitolite/blob/v3.04/src/lib/Gitolite/Rc.pm#L329 | ||
569 | - "GIT_CONFIG_KEYS" | ||
570 | - else | ||
571 | - # assume older version | ||
572 | - # see https://github.com/sitaramc/gitolite/blob/v2.3/conf/example.gitolite.rc#L49 | ||
573 | - "\\$GL_GITCONFIG_KEYS" | ||
574 | - end | ||
575 | - option_value = ".*" | ||
576 | - if open(gitoliterc_path).grep(/#{option_name}\s*=[>]?\s*["']#{option_value}["']/).any? | ||
577 | - puts "yes".green | ||
578 | - else | ||
579 | - puts "no".red | ||
580 | - try_fixing_it( | ||
581 | - "Open #{gitoliterc_path}", | ||
582 | - "Find the \"#{option_name}\" option", | ||
583 | - "Change its value to \".*\"" | ||
584 | - ) | ||
585 | - for_more_information( | ||
586 | - see_installation_guide_section "Gitolite" | ||
587 | - ) | ||
588 | - fix_and_rerun | ||
589 | - end | ||
590 | - end | ||
591 | - | ||
592 | - def check_gitoliterc_repo_umask | ||
593 | - gitoliterc_path = File.join(gitolite_user_home, ".gitolite.rc") | ||
594 | - | ||
595 | - print "Repo umask is 0007 in .gitolite.rc? ... " | ||
596 | - option_name = if has_gitolite3? | ||
597 | - # see https://github.com/sitaramc/gitolite/blob/v3.04/src/lib/Gitolite/Rc.pm#L328 | ||
598 | - "UMASK" | ||
599 | - else | ||
600 | - # assume older version | ||
601 | - # see https://github.com/sitaramc/gitolite/blob/v2.3/conf/example.gitolite.rc#L32 | ||
602 | - "\\$REPO_UMASK" | ||
603 | - end | ||
604 | - option_value = "0007" | ||
605 | - if open(gitoliterc_path).grep(/#{option_name}\s*=[>]?\s*#{option_value}/).any? | ||
606 | - puts "yes".green | ||
607 | - else | ||
608 | - puts "no".red | ||
609 | - try_fixing_it( | ||
610 | - "Open #{gitoliterc_path}", | ||
611 | - "Find the \"#{option_name}\" option", | ||
612 | - "Change its value to \"0007\"" | ||
613 | - ) | ||
614 | - for_more_information( | ||
615 | - see_installation_guide_section "Gitolite" | ||
616 | - ) | ||
617 | - fix_and_rerun | ||
618 | - end | ||
619 | - end | ||
620 | - | ||
621 | def check_post_receive_hook_exists | 392 | def check_post_receive_hook_exists |
622 | print "post-receive hook exists? ... " | 393 | print "post-receive hook exists? ... " |
623 | 394 |