train-core 3.4.7 → 3.4.8
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.
- checksums.yaml +4 -4
- data/lib/train/transports/ssh_connection.rb +14 -4
- data/lib/train/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 54dee42a0ad37ef8b4308a184f5bd63f869565db241c1c1fa910626d6c9a323f
|
4
|
+
data.tar.gz: afbeb697f1d0613f9d86af612e5ce6745b27b4ac597221b5e07db0e11b9d90d8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d2029c737655fc5f2eea92e290d73bbd0b6b7eac73ecc7e2e5526870e5318f6beceba8bc64c555ac451007cd1083870bba35985fa8353560a6040a5c6b997186
|
7
|
+
data.tar.gz: c57536c1bdddbde99d4955276d5fe14c20dbe84b7f109059bb8d8ee56a02f49f484811784aacf8384b1d6e5229f92f46f03fe005008677531eaef2abea55fe62
|
@@ -29,8 +29,8 @@ class Train::Transports::SSH
|
|
29
29
|
#
|
30
30
|
# @author Fletcher Nichol <fnichol@nichol.ca>
|
31
31
|
class Connection < BaseConnection # rubocop:disable Metrics/ClassLength
|
32
|
-
attr_reader
|
33
|
-
|
32
|
+
attr_reader :hostname
|
33
|
+
attr_accessor :transport_options
|
34
34
|
|
35
35
|
def initialize(options)
|
36
36
|
# Track IOS command retries to prevent infinite loop on IOError. This must
|
@@ -247,6 +247,16 @@ class Train::Transports::SSH
|
|
247
247
|
|
248
248
|
exit_status, stdout, stderr = execute_on_channel(cmd, opts, &data_handler)
|
249
249
|
|
250
|
+
# An interactive console might contain the STDERR in STDOUT
|
251
|
+
# concat both outputs for non-zero exit status.
|
252
|
+
output = "#{stdout} #{stderr}".strip if exit_status != 0
|
253
|
+
|
254
|
+
# Abstract the su - USER authentication failure
|
255
|
+
# raise the Train::UserError and passes message & reason
|
256
|
+
if output && output.match?("su: Authentication failure")
|
257
|
+
raise Train::UserError.new(output, :bad_su_user_password)
|
258
|
+
end
|
259
|
+
|
250
260
|
# Since `@session.loop` succeeded, reset the IOS command retry counter
|
251
261
|
@ios_cmd_retries = 0
|
252
262
|
|
@@ -322,12 +332,12 @@ class Train::Transports::SSH
|
|
322
332
|
channel.exec(cmd) do |_, success|
|
323
333
|
abort "Couldn't execute command on SSH." unless success
|
324
334
|
channel.on_data do |_, data|
|
325
|
-
yield(data) if block_given?
|
335
|
+
yield(data, channel) if block_given?
|
326
336
|
stdout += data
|
327
337
|
end
|
328
338
|
|
329
339
|
channel.on_extended_data do |_, _type, data|
|
330
|
-
yield(data) if block_given?
|
340
|
+
yield(data, channel) if block_given?
|
331
341
|
stderr += data
|
332
342
|
end
|
333
343
|
|
data/lib/train/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: train-core
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.4.
|
4
|
+
version: 3.4.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Chef InSpec Team
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-01-
|
11
|
+
date: 2021-01-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: addressable
|