File tree Expand file tree Collapse file tree 2 files changed +20
-3
lines changed
Expand file tree Collapse file tree 2 files changed +20
-3
lines changed Original file line number Diff line number Diff line change @@ -25,8 +25,25 @@ def register_hooks
2525 end
2626
2727 def execute_systemd ( *args , raise_on_non_zero_exit : true )
28- command = [ "/bin/systemctl" , "--user" ] + args
29- backend . execute ( *command , raise_on_non_zero_exit : raise_on_non_zero_exit )
28+ sudo_if_needed ( *systemd_command ( *args ) , raise_on_non_zero_exit : true )
29+ end
30+
31+ def sudo_if_needed ( *command , raise_on_non_zero_exit : true )
32+ if fetch ( :solid_queue_systemctl_user ) == :system
33+ backend . sudo command . map ( &:to_s ) . join ( " " )
34+ else
35+ backend . execute ( *command , raise_on_non_zero_exit : raise_on_non_zero_exit )
36+ end
37+ end
38+
39+ def systemd_command ( *args )
40+ command = [ '/bin/systemctl' ]
41+
42+ unless fetch ( :solid_queue_systemctl_user ) == :system
43+ command << "--user"
44+ end
45+
46+ command + args
3047 end
3148
3249 def fetch_systemd_unit_path
Original file line number Diff line number Diff line change 22
33module Capistrano
44 module SolidQueue
5- VERSION = "0.1.0 "
5+ VERSION = "0.1.1 "
66 end
77end
You can’t perform that action at this time.
0 commit comments