From a1f67ed70cf82bb6bd69d11b6e55d682abc2b15f Mon Sep 17 00:00:00 2001 From: Stafford Brunk Date: Wed, 30 Sep 2015 17:31:27 -0400 Subject: [PATCH] Make sidekiq_user optional in cap2 task like it is in cap3 --- lib/capistrano/tasks/capistrano2.rb | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/capistrano/tasks/capistrano2.rb b/lib/capistrano/tasks/capistrano2.rb index 6888f07..55861e2 100644 --- a/lib/capistrano/tasks/capistrano2.rb +++ b/lib/capistrano/tasks/capistrano2.rb @@ -59,8 +59,12 @@ def for_each_role end def run_as(cmd) + opts = { + roles: sidekiq_role + } su_user = fetch(:sidekiq_user) - run cmd, roles: sidekiq_role, shell: "su - #{su_user}" + opts[:shell] = "su - #{su_user}" if su_user + run cmd, opts end def quiet_process(pid_file, idx, sidekiq_role)