Audit details (#1)
Audit details * Audit logs and broadcasts accept `details` whose values are included as log tags and MRSK_* env vars passed to the broadcast command * Commands may return execution options to the CLI in their args list * Introduce `mrsk broadcast` helper for sending audit broadcasts * Report UTC time, not local time, in audit logs. Standardize on ISO 8601 format
This commit is contained in:
@@ -60,7 +60,7 @@ class Mrsk::Cli::App < Mrsk::Cli::Base
|
||||
roles = MRSK.roles_on(host)
|
||||
|
||||
roles.each do |role|
|
||||
execute *MRSK.auditor(role: role).record("Stopped app"), verbosity: :debug
|
||||
execute *MRSK.auditor.record("Stopped app", role: role), verbosity: :debug
|
||||
execute *MRSK.app(role: role).stop, raise_on_non_zero_exit: false
|
||||
end
|
||||
end
|
||||
@@ -107,7 +107,7 @@ class Mrsk::Cli::App < Mrsk::Cli::Base
|
||||
roles = MRSK.roles_on(host)
|
||||
|
||||
roles.each do |role|
|
||||
execute *MRSK.auditor(role: role).record("Executed cmd '#{cmd}' on app version #{version}"), verbosity: :debug
|
||||
execute *MRSK.auditor.record("Executed cmd '#{cmd}' on app version #{version}", role: role), verbosity: :debug
|
||||
puts_by_host host, capture_with_info(*MRSK.app(role: role).execute_in_existing_container(cmd))
|
||||
end
|
||||
end
|
||||
@@ -214,7 +214,7 @@ class Mrsk::Cli::App < Mrsk::Cli::Base
|
||||
roles = MRSK.roles_on(host)
|
||||
|
||||
roles.each do |role|
|
||||
execute *MRSK.auditor(role: role).record("Removed app container with version #{version}"), verbosity: :debug
|
||||
execute *MRSK.auditor.record("Removed app container with version #{version}", role: role), verbosity: :debug
|
||||
execute *MRSK.app(role: role).remove_container(version: version)
|
||||
end
|
||||
end
|
||||
@@ -228,7 +228,7 @@ class Mrsk::Cli::App < Mrsk::Cli::Base
|
||||
roles = MRSK.roles_on(host)
|
||||
|
||||
roles.each do |role|
|
||||
execute *MRSK.auditor(role: role).record("Removed all app containers"), verbosity: :debug
|
||||
execute *MRSK.auditor.record("Removed all app containers", role: role), verbosity: :debug
|
||||
execute *MRSK.app(role: role).remove_containers
|
||||
end
|
||||
end
|
||||
|
||||
@@ -73,9 +73,7 @@ module Mrsk::Cli
|
||||
end
|
||||
|
||||
def audit_broadcast(line)
|
||||
if broadcast = MRSK.auditor.broadcast(line)
|
||||
system(MRSK.auditor.broadcast_environment(line), broadcast)
|
||||
end
|
||||
run_locally { execute *MRSK.auditor.broadcast(line), verbosity: :debug }
|
||||
end
|
||||
|
||||
def with_lock
|
||||
|
||||
@@ -200,6 +200,13 @@ class Mrsk::Cli::Main < Mrsk::Cli::Base
|
||||
end
|
||||
end
|
||||
|
||||
desc "broadcast", "Broadcast an audit message"
|
||||
option :message, aliases: "-m", type: :string, desc: "Audit mesasge", required: true
|
||||
def broadcast
|
||||
say "Broadcast: #{options[:message]}", :magenta
|
||||
audit_broadcast options[:message]
|
||||
end
|
||||
|
||||
desc "version", "Show MRSK version"
|
||||
def version
|
||||
puts Mrsk::VERSION
|
||||
|
||||
Reference in New Issue
Block a user