Files
kamal/lib/mrsk/commands/auditor.rb
Donal McBreen 9fd184dc32 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.
2023-05-23 13:56:16 +01:00

29 lines
584 B
Ruby

class Mrsk::Commands::Auditor < Mrsk::Commands::Base
attr_reader :details
def initialize(config, **details)
super(config)
@details = details
end
# Runs remotely
def record(line, **details)
append \
[ :echo, audit_tags(**details).except(:version).to_s, line ],
audit_log_file
end
def reveal
[ :tail, "-n", 50, audit_log_file ]
end
private
def audit_log_file
[ "mrsk", config.service, config.destination, "audit.log" ].compact.join("-")
end
def audit_tags(**details)
tags(**self.details, **details)
end
end