Skip to content
Snippets Groups Projects
Commit c54b40d1 authored by Marin Jankovski's avatar Marin Jankovski Committed by Wes Gurney
Browse files

Rescue an error if group doesn't exist

parent 0187d184
No related branches found
No related tags found
1 merge request!4954Add support to configure webhook_timeout in gitlab.yaml
Loading
Loading
@@ -479,11 +479,13 @@ namespace :gitlab do
return
end
 
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)
uid = uid_for(gitlab_shell_ssh_user)
gid = gid_for(gitlab_shell_owner_group)
if File.stat(repo_base_path).uid == uid && File.stat(repo_base_path).gid == gid
puts "yes".green
else
puts "no".red
puts " User id for #{gitlab_shell_ssh_user}: #{uid}. Groupd id for #{gitlab_shell_owner_group}: #{gid}".blue
try_fixing_it(
"sudo chown -R #{gitlab_shell_ssh_user}:#{gitlab_shell_owner_group} #{repo_base_path}"
)
Loading
Loading
Loading
Loading
@@ -80,7 +80,11 @@ namespace :gitlab do
end
 
def gid_for(group_name)
Etc.getgrnam(group_name).gid
begin
Etc.getgrnam(group_name).gid
rescue ArgumentError # no group
"group #{group_name} doesn't exist"
end
end
 
def warn_user_is_not_gitlab
Loading
Loading
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