summaryrefslogtreecommitdiff
path: root/lib/tasks/gitlab/task_helpers.rake
diff options
context:
space:
mode:
Diffstat (limited to 'lib/tasks/gitlab/task_helpers.rake')
-rw-r--r--lib/tasks/gitlab/task_helpers.rake9
1 files changed, 9 insertions, 0 deletions
diff --git a/lib/tasks/gitlab/task_helpers.rake b/lib/tasks/gitlab/task_helpers.rake
index 5b5c3c30ba2..5dd97fa2f92 100644
--- a/lib/tasks/gitlab/task_helpers.rake
+++ b/lib/tasks/gitlab/task_helpers.rake
@@ -45,6 +45,15 @@ namespace :gitlab do
end
end
+ def uid_for(user_name)
+ run("id -u #{user_name}").chomp.to_i
+ end
+
+ def gid_for(group_name)
+ group_line = File.read("/etc/group").lines.select{|l| l.start_with?("#{group_name}:")}.first
+ group_line.split(":")[2].to_i
+ end
+
def warn_user_is_not_gitlab
unless @warned_user_not_gitlab
current_user = run("whoami").chomp