ztk 0.0.12 → 0.0.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/lib/ztk/logger.rb +3 -2
- data/lib/ztk/ssh.rb +2 -3
- data/lib/ztk/version.rb +1 -1
- metadata +2 -9
data/lib/ztk/logger.rb
CHANGED
@@ -80,11 +80,12 @@ module ZTK
|
|
80
80
|
def add(severity, message = nil, progname = nil, &block)
|
81
81
|
return if (@level > severity)
|
82
82
|
|
83
|
-
called_by = parse_caller(caller[1])
|
84
83
|
msg = (block && block.call)
|
85
84
|
(msg.nil? || msg.strip.empty?) and return
|
85
|
+
@hostname ||= %x(hostname -s).chomp.strip
|
86
|
+
called_by = parse_caller(caller[1])
|
86
87
|
message = [message, progname, msg].flatten.compact.join(": ")
|
87
|
-
message = "%19s.%06d|%05d|%5s|%s%s\n" % [Time.now.utc.strftime("%Y-%m-%d|%H:%M:%S"), Time.now.utc.usec, Process.pid, SEVERITIES[severity], called_by, message]
|
88
|
+
message = "%19s.%06d|%05d|%5s|%s|%40s%s\n" % [Time.now.utc.strftime("%Y-%m-%d|%H:%M:%S"), Time.now.utc.usec, Process.pid, SEVERITIES[severity], @hostname, called_by, message]
|
88
89
|
|
89
90
|
@logdev.write(message)
|
90
91
|
|
data/lib/ztk/ssh.rb
CHANGED
@@ -123,11 +123,10 @@ module ZTK
|
|
123
123
|
@sftp ||= Net::SFTP.start(@config.host_name, @config.user, ssh_options)
|
124
124
|
end
|
125
125
|
|
126
|
-
# Close our
|
126
|
+
# Close our session gracefully.
|
127
127
|
def close
|
128
128
|
log(:debug) { "close" }
|
129
|
-
ssh and ssh.close
|
130
|
-
sftp and sftp.close
|
129
|
+
ssh and !ssh.closed? and ssh.close
|
131
130
|
end
|
132
131
|
|
133
132
|
# Launches an SSH console, replacing the current process with the console
|
data/lib/ztk/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ztk
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.14
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-01-
|
12
|
+
date: 2013-01-21 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: erubis
|
@@ -206,18 +206,12 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
206
206
|
- - ! '>='
|
207
207
|
- !ruby/object:Gem::Version
|
208
208
|
version: '0'
|
209
|
-
segments:
|
210
|
-
- 0
|
211
|
-
hash: 3569323308884458346
|
212
209
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
213
210
|
none: false
|
214
211
|
requirements:
|
215
212
|
- - ! '>='
|
216
213
|
- !ruby/object:Gem::Version
|
217
214
|
version: '0'
|
218
|
-
segments:
|
219
|
-
- 0
|
220
|
-
hash: 3569323308884458346
|
221
215
|
requirements: []
|
222
216
|
rubyforge_project:
|
223
217
|
rubygems_version: 1.8.24
|
@@ -235,4 +229,3 @@ test_files:
|
|
235
229
|
- spec/ztk/ssh_spec.rb
|
236
230
|
- spec/ztk/tcp_socket_check_spec.rb
|
237
231
|
- spec/ztk/template_spec.rb
|
238
|
-
has_rdoc:
|