Get lock status by executing directly

Getting the lock status with invoke passes through any options from the
original command which will raise an exception if they are not also
valid for the lock status command.

Fixes https://github.com/mrsked/mrsk/issues/239
This commit is contained in:
Donal McBreen
2023-04-25 15:15:55 +01:00
parent 1a7d123746
commit cd668066ff
2 changed files with 3 additions and 2 deletions

View File

@@ -105,7 +105,7 @@ module Mrsk::Cli
MRSK.holding_lock = true
rescue SSHKit::Runner::ExecuteError => e
if e.message =~ /cannot create directory/
invoke "mrsk:cli:lock:status", []
on(MRSK.primary_host) { execute *MRSK.lock.status }
raise LockError, "Deploy lock found"
else
raise e