ztk 1.0.1 → 1.0.2
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/command.rb +7 -7
- data/lib/ztk/ssh.rb +7 -7
- data/lib/ztk/version.rb +1 -1
- metadata +4 -4
data/lib/ztk/command.rb
CHANGED
@@ -104,9 +104,9 @@ module ZTK
|
|
104
104
|
reader_writer_key = {parent_stdout_reader => :stdout, parent_stderr_reader => :stderr}
|
105
105
|
reader_writer_map = {parent_stdout_reader => options.ui.stdout, parent_stderr_reader => options.ui.stderr}
|
106
106
|
|
107
|
-
direct_log(:
|
108
|
-
direct_log(:
|
109
|
-
direct_log(:
|
107
|
+
direct_log(:info) { log_header("COMMAND") }
|
108
|
+
direct_log(:info) { "#{command}\n" }
|
109
|
+
direct_log(:info) { log_header("STARTED") }
|
110
110
|
|
111
111
|
begin
|
112
112
|
Timeout.timeout(options.timeout) do
|
@@ -119,12 +119,12 @@ module ZTK
|
|
119
119
|
case reader_writer_key[pipe]
|
120
120
|
when :stdout then
|
121
121
|
if !stdout_header
|
122
|
-
direct_log(:
|
122
|
+
direct_log(:info) { log_header("STDOUT") }
|
123
123
|
stdout_header = true
|
124
124
|
stderr_header = false
|
125
125
|
end
|
126
126
|
reader_writer_map[pipe].write(data) unless options.silence
|
127
|
-
direct_log(:
|
127
|
+
direct_log(:info) { data }
|
128
128
|
|
129
129
|
when :stderr then
|
130
130
|
if !stderr_header
|
@@ -142,13 +142,13 @@ module ZTK
|
|
142
142
|
end
|
143
143
|
end
|
144
144
|
rescue Timeout::Error => e
|
145
|
-
direct_log(:
|
145
|
+
direct_log(:fatal) { log_header("TIMEOUT") }
|
146
146
|
log_and_raise(CommandError, "Process timed out after #{options.timeout} seconds!")
|
147
147
|
end
|
148
148
|
|
149
149
|
Process.waitpid(pid)
|
150
150
|
exit_code = $?.exitstatus
|
151
|
-
direct_log(:
|
151
|
+
direct_log(:info) { log_header("STOPPED") }
|
152
152
|
|
153
153
|
parent_stdout_reader.close
|
154
154
|
parent_stderr_reader.close
|
data/lib/ztk/ssh.rb
CHANGED
@@ -223,20 +223,20 @@ module ZTK
|
|
223
223
|
channel = ssh.open_channel do |chan|
|
224
224
|
options.ui.logger.debug { "Channel opened." }
|
225
225
|
|
226
|
-
direct_log(:
|
227
|
-
direct_log(:
|
228
|
-
direct_log(:
|
226
|
+
direct_log(:info) { log_header("COMMAND") }
|
227
|
+
direct_log(:info) { "#{command}\n" }
|
228
|
+
direct_log(:info) { log_header("OPENED") }
|
229
229
|
|
230
230
|
chan.exec(command) do |ch, success|
|
231
231
|
success or log_and_raise(SSHError, "Could not execute '#{command}'.")
|
232
232
|
|
233
233
|
ch.on_data do |c, data|
|
234
234
|
if !stdout_header
|
235
|
-
direct_log(:
|
235
|
+
direct_log(:info) { log_header("STDOUT") }
|
236
236
|
stdout_header = true
|
237
237
|
stderr_header = false
|
238
238
|
end
|
239
|
-
direct_log(:
|
239
|
+
direct_log(:info) { data }
|
240
240
|
|
241
241
|
options.ui.stdout.print(data) unless options.silence
|
242
242
|
output += data
|
@@ -270,13 +270,13 @@ module ZTK
|
|
270
270
|
end
|
271
271
|
channel.wait
|
272
272
|
|
273
|
-
direct_log(:
|
273
|
+
direct_log(:info) { log_header("CLOSED") }
|
274
274
|
options.ui.logger.debug { "Channel closed." }
|
275
275
|
end
|
276
276
|
end
|
277
277
|
|
278
278
|
rescue Timeout::Error => e
|
279
|
-
direct_log(:
|
279
|
+
direct_log(:fatal) { log_header("TIMEOUT") }
|
280
280
|
log_and_raise(SSHError, "Session timed out after #{options.timeout} seconds!")
|
281
281
|
end
|
282
282
|
|
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: 1.0.
|
4
|
+
version: 1.0.2
|
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-02-
|
12
|
+
date: 2013-02-11 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: erubis
|
@@ -250,7 +250,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
250
250
|
version: '0'
|
251
251
|
segments:
|
252
252
|
- 0
|
253
|
-
hash:
|
253
|
+
hash: -3536505890360797724
|
254
254
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
255
255
|
none: false
|
256
256
|
requirements:
|
@@ -259,7 +259,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
259
259
|
version: '0'
|
260
260
|
segments:
|
261
261
|
- 0
|
262
|
-
hash:
|
262
|
+
hash: -3536505890360797724
|
263
263
|
requirements: []
|
264
264
|
rubyforge_project:
|
265
265
|
rubygems_version: 1.8.24
|