summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDouwe Maan <douwe@gitlab.com>2015-08-26 10:13:11 -0700
committerDouwe Maan <douwe@gitlab.com>2015-08-26 10:13:11 -0700
commitf197785495e83c996150b05d9bc3ce1effcc5a68 (patch)
treed1762bbe21684743c6f999cea93e4ba51a5b5a23
parentd0420c68fbb2fe84dee8538df246cdc7e7b85d28 (diff)
downloadgitlab-ce-f197785495e83c996150b05d9bc3ce1effcc5a68.tar.gz
Use sudu -u git where appropriate
-rw-r--r--doc/reply_by_email/README.md2
-rw-r--r--lib/tasks/gitlab/check.rake10
2 files changed, 7 insertions, 5 deletions
diff --git a/doc/reply_by_email/README.md b/doc/reply_by_email/README.md
index 6c3d191cc71..b33303c7be8 100644
--- a/doc/reply_by_email/README.md
+++ b/doc/reply_by_email/README.md
@@ -92,7 +92,7 @@ In this example, we'll use the Gmail address `gitlab-replies@gmail.com`.
7. Check if everything is configured correctly:
```sh
- sudo bundle exec rake gitlab:reply_by_email:check RAILS_ENV=production
+ sudo -u git -H bundle exec rake gitlab:reply_by_email:check RAILS_ENV=production
```
8. Reply by email should now be working.
diff --git a/lib/tasks/gitlab/check.rake b/lib/tasks/gitlab/check.rake
index 13f1cf58fca..f5a900d87c9 100644
--- a/lib/tasks/gitlab/check.rake
+++ b/lib/tasks/gitlab/check.rake
@@ -595,7 +595,7 @@ namespace :gitlab do
else
puts "no".red
try_fixing_it(
- sudo_gitlab("RAILS_ENV=production sudo -u git -H bin/background_jobs start")
+ sudo_gitlab("bin/background_jobs start", "RAILS_ENV=production")
)
for_more_information(
see_installation_guide_section("Install Init Script"),
@@ -726,7 +726,7 @@ namespace :gitlab do
else
puts "no".red
try_fixing_it(
- sudo_gitlab("RAILS_ENV=production sudo -u git -H bin/mail_room start")
+ sudo_gitlab("bin/mail_room start", "RAILS_ENV=production")
)
for_more_information(
see_installation_guide_section("Install Init Script"),
@@ -879,8 +879,10 @@ namespace :gitlab do
"doc/install/installation.md in section \"#{section}\""
end
- def sudo_gitlab(command)
- "sudo -u #{gitlab_user} -H #{command}"
+ def sudo_gitlab(command, env = nil)
+ cmd = "sudo -u #{gitlab_user} -H #{command}"
+ cmd.prepend "#{env} " if env
+ cmd
end
def gitlab_user