train-core 3.4.7 → 3.4.8

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e85ed8cc37da145f7dabcff7855b85b9c2a6bc8f216945aeaa693843c07f8b95
4
- data.tar.gz: a4ac06f8b1c2ced955d933ba1a9553d9434c9d255d11ec5d8cc43e14e1cc0469
3
+ metadata.gz: 54dee42a0ad37ef8b4308a184f5bd63f869565db241c1c1fa910626d6c9a323f
4
+ data.tar.gz: afbeb697f1d0613f9d86af612e5ce6745b27b4ac597221b5e07db0e11b9d90d8
5
5
  SHA512:
6
- metadata.gz: 0b920c8d01dbdd94eae308fcca501cf9dc5f24619f8e023e4c5cedbdd11eebcfc4b4bcb41683435325f3ede4afa5b6a7981164e1cf8242aa472e2e801282c284
7
- data.tar.gz: e3d5e835b15d0cc84f86066fe66aafc7456544f53fbe91d2a66c7341ed4db3b2f6a3d890e98aab26d0fe294af587fc246a89a10c7d56b9f4ac1cf09a99fae9d8
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 :hostname
33
- attr_reader :transport_options
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
 
@@ -2,5 +2,5 @@
2
2
  # Author:: Dominik Richter (<dominik.richter@gmail.com>)
3
3
 
4
4
  module Train
5
- VERSION = "3.4.7".freeze
5
+ VERSION = "3.4.8".freeze
6
6
  end
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.7
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 00:00:00.000000000 Z
11
+ date: 2021-01-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: addressable