Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0c03216fdf | ||
|
|
1973f55c58 | ||
|
|
0a51cd0899 |
@@ -1,7 +1,7 @@
|
||||
PATH
|
||||
remote: .
|
||||
specs:
|
||||
mrsk (0.7.0)
|
||||
mrsk (0.7.1)
|
||||
activesupport (>= 7.0)
|
||||
dotenv (~> 2.8)
|
||||
sshkit (~> 1.21)
|
||||
|
||||
@@ -4,7 +4,7 @@ class Mrsk::Commands::Auditor < Mrsk::Commands::Base
|
||||
# Runs remotely
|
||||
def record(line)
|
||||
append \
|
||||
[ :echo, tagged_line(line) ],
|
||||
[ :echo, tagged_record_line(line) ],
|
||||
audit_log_file
|
||||
end
|
||||
|
||||
@@ -12,7 +12,7 @@ class Mrsk::Commands::Auditor < Mrsk::Commands::Base
|
||||
def broadcast(line)
|
||||
if broadcast_cmd = config.audit_broadcast_cmd
|
||||
pipe \
|
||||
[ :echo, tagged_line(line) ],
|
||||
[ :echo, tagged_broadcast_line(line) ],
|
||||
broadcast_cmd
|
||||
end
|
||||
end
|
||||
@@ -26,19 +26,19 @@ class Mrsk::Commands::Auditor < Mrsk::Commands::Base
|
||||
"mrsk-#{config.service}-audit.log"
|
||||
end
|
||||
|
||||
def tagged_line(line)
|
||||
"'#{tags} #{line}'"
|
||||
def tagged_record_line(line)
|
||||
"'#{recorded_at_tag} #{performer_tag} #{line}'"
|
||||
end
|
||||
|
||||
def tags
|
||||
"[#{recorded_at}] [#{performer}]"
|
||||
def tagged_broadcast_line(line)
|
||||
"'#{performer_tag} #{line}'"
|
||||
end
|
||||
|
||||
def performer
|
||||
@performer ||= `whoami`.strip
|
||||
def performer_tag
|
||||
"[#{`whoami`.strip}]"
|
||||
end
|
||||
|
||||
def recorded_at
|
||||
Time.now.to_fs(:db)
|
||||
def recorded_at_tag
|
||||
"[#{Time.now.to_fs(:db)}]"
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
module Mrsk
|
||||
VERSION = "0.7.0"
|
||||
VERSION = "0.7.1"
|
||||
end
|
||||
|
||||
@@ -181,6 +181,6 @@ class ConfigurationTest < ActiveSupport::TestCase
|
||||
end
|
||||
|
||||
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
|
||||
|
||||
Reference in New Issue
Block a user