Only stopping containers locks

This commit is contained in:
Donal McBreen
2024-04-03 12:38:10 +01:00
parent 2c2d94c6d9
commit 6a7c90cf4d
2 changed files with 4 additions and 6 deletions

View File

@@ -135,11 +135,9 @@ class Kamal::Cli::App < Kamal::Cli::Base
desc "stale_containers", "Detect app stale containers" desc "stale_containers", "Detect app stale containers"
option :stop, aliases: "-s", type: :boolean, default: false, desc: "Stop the stale containers found" option :stop, aliases: "-s", type: :boolean, default: false, desc: "Stop the stale containers found"
def stale_containers def stale_containers
mutating do
stop = options[:stop] stop = options[:stop]
cli = self mutating(mutates: stop) do
on(KAMAL.hosts) do |host| on(KAMAL.hosts) do |host|
roles = KAMAL.roles_on(host) roles = KAMAL.roles_on(host)

View File

@@ -79,8 +79,8 @@ module Kamal::Cli
puts " Finished all in #{sprintf("%.1f seconds", runtime)}" puts " Finished all in #{sprintf("%.1f seconds", runtime)}"
end end
def mutating def mutating(mutates: true)
return yield if KAMAL.holding_lock? return yield if KAMAL.holding_lock? || !mutates
run_hook "pre-connect" run_hook "pre-connect"