From 8c774dae5ad9e4b21011d3b0dd088f8c79f432ef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C4=BDubo?= Date: Wed, 26 Mar 2025 10:58:33 +0100 Subject: [PATCH 1/2] Make system user work --- lib/capistrano/solid_queue.rb | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/lib/capistrano/solid_queue.rb b/lib/capistrano/solid_queue.rb index 4417f52..ad81f4b 100644 --- a/lib/capistrano/solid_queue.rb +++ b/lib/capistrano/solid_queue.rb @@ -25,8 +25,25 @@ def register_hooks end def execute_systemd(*args, raise_on_non_zero_exit: true) - command = ["/bin/systemctl", "--user"] + args - backend.execute(*command, raise_on_non_zero_exit: raise_on_non_zero_exit) + sudo_if_needed(*systemd_command(*args), raise_on_non_zero_exit: true) + end + + def sudo_if_needed(*command, raise_on_non_zero_exit: true) + if fetch(:solid_queue_systemctl_user) == :system + backend.sudo command.map(&:to_s).join(" ") + else + backend.execute(*command, raise_on_non_zero_exit: raise_on_non_zero_exit) + end + end + + def systemd_command(*args) + command = ['/bin/systemctl'] + + unless fetch(:solid_queue_systemctl_user) == :system + command << "--user" + end + + command + args end def fetch_systemd_unit_path From 9520d9aaeba21a7877ff0c018159d677bf0fadf9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C4=BDubo?= Date: Wed, 26 Mar 2025 10:58:50 +0100 Subject: [PATCH 2/2] bump version --- lib/capistrano/solid_queue/version.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/capistrano/solid_queue/version.rb b/lib/capistrano/solid_queue/version.rb index dc8ca3e..aa66bbe 100644 --- a/lib/capistrano/solid_queue/version.rb +++ b/lib/capistrano/solid_queue/version.rb @@ -2,6 +2,6 @@ module Capistrano module SolidQueue - VERSION = "0.1.0" + VERSION = "0.1.1" end end