Skip to content

Let solid_queue:quiet go on when systemctl fails - #10

Merged
burisu merged 1 commit into
mainfrom
quiet-raise-on-non-zero-exit
Nov 9, 2026
Merged

burisu merged 1 commit into
mainfrom
quiet-raise-on-non-zero-exit

Conversation

@burisu

@burisu burisu commented Nov 9, 2026 •

Copy link
Copy Markdown
Contributor

Based on #9 (reuses its test Capistrano project).

Problem

solid_queue:quiet (hook after "deploy:starting") calls execute_systemd(..., raise_on_non_zero_exit: false) so that a failing systemctl kill doesn't block the deploy. Since :system support (8c774da, v0.1.1), execute_systemd always passes raise_on_non_zero_exit: true, and the :system branch (backend.sudo) ignored the option. A failing systemctl kill therefore stops the deploy at deploy:starting.

Changes

  • lib/capistrano/solid_queue.rb: execute_systemd passes the option it receives to sudo_if_needed, which also passes it to backend.sudo (Capistrano's DSL sudo runs execute :sudo, *args, so it accepts the options of execute).
  • The other tasks (start, stop, restart…) keep raise_on_non_zero_exit: true.
  • The test Capistrano project from Use :rails_env for RAILS_ENV in the systemd service #9 moves to test/test_helper.rb (CapistranoProject#run_cap) so both test files can use it.

Tests

test/capistrano/test_systemctl_failure.rb runs cap preprod <task> in the test project (SSHKit Local backend), with systemctl (or sudo in :system mode) replaced by false through SSHKit.config.command_map:

  • solid_queue:quiet in user mode → cap succeeds (failed without the fix: /bin/systemctl exit status: 256);
  • solid_queue:quiet in :system mode → cap succeeds (failed without the fix: sudo exit status: 256);
  • solid_queue:stop → cap fails with SSHKit::Command::Failed: /bin/systemctl exit status.

Mutation: putting true back in execute_systemd makes both quiet tests fail; removing the option from backend.sudo makes the :system test fail.

bundle exec rake (tests + standard): green locally (Ruby 4.0.6).

🤖 Generated with Claude Code

solid_queue:quiet demande raise_on_non_zero_exit: false, mais
execute_systemd transmettait toujours true depuis la prise en charge
de :system (8c774da, v0.1.1), et la branche sudo n'en tenait pas
compte : un échec de `systemctl kill` arrêtait le déploiement dès
deploy:starting.

execute_systemd et sudo_if_needed transmettent maintenant l'option,
en mode utilisateur comme en mode :system. Les autres tâches gardent
raise_on_non_zero_exit: true.

Le projet Capistrano de test passe dans test_helper.rb pour servir
aux deux fichiers de test.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@burisu
burisu deleted the branch rails-env-from-capistrano November 9, 2026 08:20
@burisu burisu closed this Nov 9, 2026
@burisu burisu reopened this Nov 9, 2026
@burisu
burisu changed the base branch from rails-env-from-capistrano to main November 9, 2026 08:21
@burisu
burisu marked this pull request as ready for review November 9, 2026 08:40
@burisu
burisu merged commit f1859a3 into main Nov 9, 2026
10 checks passed
@burisu
burisu deleted the quiet-raise-on-non-zero-exit branch November 9, 2026 08:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant