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:
@@ -105,7 +105,7 @@ module Mrsk::Cli
|
|||||||
MRSK.holding_lock = true
|
MRSK.holding_lock = true
|
||||||
rescue SSHKit::Runner::ExecuteError => e
|
rescue SSHKit::Runner::ExecuteError => e
|
||||||
if e.message =~ /cannot create directory/
|
if e.message =~ /cannot create directory/
|
||||||
invoke "mrsk:cli:lock:status", []
|
on(MRSK.primary_host) { execute *MRSK.lock.status }
|
||||||
raise LockError, "Deploy lock found"
|
raise LockError, "Deploy lock found"
|
||||||
else
|
else
|
||||||
raise e
|
raise e
|
||||||
|
|||||||
@@ -64,7 +64,8 @@ class CliMainTest < CliTestCase
|
|||||||
.with { |*arg| arg[0..1] == [:mkdir, :mrsk_lock] }
|
.with { |*arg| arg[0..1] == [:mkdir, :mrsk_lock] }
|
||||||
.raises(RuntimeError, "mkdir: cannot create directory ‘mrsk_lock’: File exists")
|
.raises(RuntimeError, "mkdir: cannot create directory ‘mrsk_lock’: File exists")
|
||||||
|
|
||||||
Mrsk::Cli::Base.any_instance.expects(:invoke).with("mrsk:cli:lock:status", [])
|
SSHKit::Backend::Abstract.any_instance.expects(:execute)
|
||||||
|
.with(:stat, :mrsk_lock, ">", "/dev/null", "&&", :cat, "mrsk_lock/details", "|", :base64, "-d")
|
||||||
|
|
||||||
assert_raises(Mrsk::Cli::LockError) do
|
assert_raises(Mrsk::Cli::LockError) do
|
||||||
run_command("deploy")
|
run_command("deploy")
|
||||||
|
|||||||
Reference in New Issue
Block a user