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.
@@ -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
 
@@ -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 sessions gracefully.
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
@@ -19,5 +19,5 @@
19
19
  ################################################################################
20
20
 
21
21
  module ZTK
22
- VERSION = "0.0.12" unless const_defined?(:VERSION)
22
+ VERSION = "0.0.14" unless const_defined?(:VERSION)
23
23
  end
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.12
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-20 00:00:00.000000000 Z
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: