Compare commits

...

3 Commits

Author SHA1 Message Date
David Heinemeier Hansson
0c03216fdf Bump version for 0.7.1 2023-02-18 16:33:28 +01:00
David Heinemeier Hansson
1973f55c58 Don't include recorded_at with broadcast line
Receiving end will already add that
2023-02-18 16:33:12 +01:00
David Heinemeier Hansson
0a51cd0899 Update for healthcheck config 2023-02-18 16:28:31 +01:00
4 changed files with 13 additions and 13 deletions

View File

@@ -1,7 +1,7 @@
PATH PATH
remote: . remote: .
specs: specs:
mrsk (0.7.0) mrsk (0.7.1)
activesupport (>= 7.0) activesupport (>= 7.0)
dotenv (~> 2.8) dotenv (~> 2.8)
sshkit (~> 1.21) sshkit (~> 1.21)

View File

@@ -4,7 +4,7 @@ class Mrsk::Commands::Auditor < Mrsk::Commands::Base
# Runs remotely # Runs remotely
def record(line) def record(line)
append \ append \
[ :echo, tagged_line(line) ], [ :echo, tagged_record_line(line) ],
audit_log_file audit_log_file
end end
@@ -12,7 +12,7 @@ class Mrsk::Commands::Auditor < Mrsk::Commands::Base
def broadcast(line) def broadcast(line)
if broadcast_cmd = config.audit_broadcast_cmd if broadcast_cmd = config.audit_broadcast_cmd
pipe \ pipe \
[ :echo, tagged_line(line) ], [ :echo, tagged_broadcast_line(line) ],
broadcast_cmd broadcast_cmd
end end
end end
@@ -26,19 +26,19 @@ class Mrsk::Commands::Auditor < Mrsk::Commands::Base
"mrsk-#{config.service}-audit.log" "mrsk-#{config.service}-audit.log"
end end
def tagged_line(line) def tagged_record_line(line)
"'#{tags} #{line}'" "'#{recorded_at_tag} #{performer_tag} #{line}'"
end end
def tags def tagged_broadcast_line(line)
"[#{recorded_at}] [#{performer}]" "'#{performer_tag} #{line}'"
end end
def performer def performer_tag
@performer ||= `whoami`.strip "[#{`whoami`.strip}]"
end end
def recorded_at def recorded_at_tag
Time.now.to_fs(:db) "[#{Time.now.to_fs(:db)}]"
end end
end end

View File

@@ -1,3 +1,3 @@
module Mrsk module Mrsk
VERSION = "0.7.0" VERSION = "0.7.1"
end end

View File

@@ -181,6 +181,6 @@ class ConfigurationTest < ActiveSupport::TestCase
end end
test "to_h" do test "to_h" do
assert_equal({ :roles=>["web"], :hosts=>["1.1.1.1", "1.1.1.2"], :primary_host=>"1.1.1.1", :version=>"missing", :repository=>"dhh/app", :absolute_image=>"dhh/app:missing", :service_with_version=>"app-missing", :env_args=>["-e", "REDIS_URL=redis://x/y"], :ssh_options=>{:user=>"root", :auth_methods=>["publickey"]}, :volume_args=>["--volume", "/local/path:/container/path"] }, @config.to_h) assert_equal({ :roles=>["web"], :hosts=>["1.1.1.1", "1.1.1.2"], :primary_host=>"1.1.1.1", :version=>"missing", :repository=>"dhh/app", :absolute_image=>"dhh/app:missing", :service_with_version=>"app-missing", :env_args=>["-e", "REDIS_URL=redis://x/y"], :ssh_options=>{:user=>"root", :auth_methods=>["publickey"]}, :volume_args=>["--volume", "/local/path:/container/path"], :healthcheck=>{"path"=>"/up", "port"=>3000 }}, @config.to_h)
end end
end end