Add post-deploy and post-rollback hooks

These replace the custom audit_broadcast_cmd code. An additional env
variable MRSK_RUNTIME is passed to them.

The audit broadcast after booting an accessory has been removed.
This commit is contained in:
Donal McBreen
2023-05-23 08:45:25 +01:00
parent 38023fe538
commit 9fd184dc32
18 changed files with 117 additions and 122 deletions

View File

@@ -72,10 +72,6 @@ module Mrsk::Cli
puts " Finished all in #{sprintf("%.1f seconds", runtime)}"
end
def audit_broadcast(line)
run_locally { execute *MRSK.auditor.broadcast(line), verbosity: :debug }
end
def with_lock
if MRSK.holding_lock?
yield
@@ -135,11 +131,11 @@ module Mrsk::Cli
end
end
def run_hook(hook)
def run_hook(hook, **details)
run_locally do
if MRSK.hook.hook_exists?(hook)
begin
MRSK.with_verbosity(:debug) { execute(*MRSK.hook.run(hook)) }
MRSK.with_verbosity(:debug) { execute(*MRSK.hook.run(hook, **details)) }
rescue SSHKit::Command::Failed
raise HookError.new("Hook `#{hook}` failed")
end