Split lock and connection setup

Allow run the pre-connect hook before the first SSH command is executed,
but only run the locking in `with_lock` blocks.
This commit is contained in:
Donal McBreen
2024-05-20 15:03:38 +01:00
parent 83d0078525
commit 0e73f02743
11 changed files with 125 additions and 91 deletions

View File

@@ -3,7 +3,7 @@ require "tempfile"
class Kamal::Cli::Env < Kamal::Cli::Base
desc "push", "Push the env file to the remote hosts"
def push
mutating do
with_lock do
on(KAMAL.hosts) do
execute *KAMAL.auditor.record("Pushed env files"), verbosity: :debug
@@ -30,7 +30,7 @@ class Kamal::Cli::Env < Kamal::Cli::Base
desc "delete", "Delete the env file from the remote hosts"
def delete
mutating do
with_lock do
on(KAMAL.hosts) do
execute *KAMAL.auditor.record("Deleted env files"), verbosity: :debug