Class: MKIt::DockerLogListener
Instance Method Summary
collapse
#attach_network, #clear_logs, #create_instance, #create_network, #create_volume, #delete_volume, #dettach_network, #execute_local, #inspect_instance, #inspect_volume, #logfile, #logs, #network_exists?, #remove_instance, #remove_network, #start_instance, #stop_instance
Methods inherited from ShellClient
#unregister
Constructor Details
#initialize(pod, ws, options: {}) ⇒ DockerLogListener
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
# File 'lib/mkit/pods/docker_log_listener.rb', line 9
def initialize(pod, ws, options: {})
if options[:clear]
clear_logs(pod.name)
end
@pod = pod
@ws = ws
command = "docker logs"
command += " -f" if options[:follow] == 'true'
command += " -n #{options[:nr_lines]}" if options[:nr_lines]
command += " -n 10" unless options[:nr_lines]
command += " -t" if options[:timestamps] == 'true'
command += " --since #{options[:since]}" if options[:since]
command += " --until #{options[:until]}" if options[:until]
command += " --details" if options[:details] == 'true'
command += " #{@pod.name}"
super(command: command)
end
|
Instance Method Details
#close ⇒ Object
35
36
37
|
# File 'lib/mkit/pods/docker_log_listener.rb', line 35
def close
@ws.close_websocket unless @ws.nil?
end
|
#register ⇒ Object
27
28
29
30
31
32
33
|
# File 'lib/mkit/pods/docker_log_listener.rb', line 27
def register
super do |stdout, stdin, pid|
stdout.each {
|line| @ws.send(line.strip!)
}
end
end
|