Skip to content

Commit

Permalink
Merge pull request #139 from jhollinger/monit-use-global-puma_user
Browse files Browse the repository at this point in the history
Respect the global puma_user setting
  • Loading branch information
seuros committed Nov 10, 2015
2 parents e17f3b7 + 05b8924 commit c1d705d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
5 changes: 3 additions & 2 deletions lib/capistrano/tasks/puma.rake
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ namespace :puma do
puma_switch_user(role) do
with rack_env: fetch(:puma_env) do
if test "[ -f #{fetch(:puma_pid)} ]"
if test "kill -0 $( cat #{fetch(:puma_pid)} )"
if test :kill, "-0 $( cat #{fetch(:puma_pid)} )"
execute :pumactl, "-S #{fetch(:puma_state)} -F #{fetch(:puma_conf)} #{command}"
else
# delete invalid pid file , process is not running.
Expand All @@ -103,7 +103,7 @@ namespace :puma do
within current_path do
puma_switch_user(role) do
with rack_env: fetch(:puma_env) do
if test "[ -f #{fetch(:puma_pid)} ]" and test "kill -0 $( cat #{fetch(:puma_pid)} )"
if test "[ -f #{fetch(:puma_pid)} ]" and test :kill, "-0 $( cat #{fetch(:puma_pid)} )"
# NOTE pid exist but state file is nonsense, so ignore that case
execute :pumactl, "-S #{fetch(:puma_state)} -F #{fetch(:puma_conf)} #{command}"
else
Expand Down Expand Up @@ -152,6 +152,7 @@ namespace :puma do
def puma_user(role)
properties = role.properties
properties.fetch(:puma_user) || # local property for puma only
fetch(:puma_user) ||
properties.fetch(:run_as) || # global property across multiple capistrano gems
role.user
end
Expand Down
4 changes: 2 additions & 2 deletions lib/capistrano/tasks/workers.rake
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ namespace :puma do
task :more do
on roles (fetch(:puma_role)) do |role|
puma_switch_user(role) do
execute("kill -TTIN `cat #{fetch(:puma_pid)}`")
execute(:kill, "-TTIN `cat #{fetch(:puma_pid)}`")
end
end
end
Expand All @@ -30,7 +30,7 @@ namespace :puma do
task :less do
on roles (fetch(:puma_role)) do |role|
puma_switch_user(role) do
execute("kill -TTOU `cat #{fetch(:puma_pid)}`")
execute(:kill, "-TTOU `cat #{fetch(:puma_pid)}`")
end
end
end
Expand Down

0 comments on commit c1d705d

Please # to comment.