train-core 3.2.28 → 3.3.13

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: 3cfdc185e0d7c0d0b9271fb1ccd626cac1ef57d56988660727f1b04fa2551446
4
- data.tar.gz: a9a030b0fd0bd204d2fa3e628dbffe182a52bbf75e4382fbd44de8dba684ac35
3
+ metadata.gz: 49d500e3ff1e260a0879ff7da716c7407934e53deef0f15df171c03cd26c9dff
4
+ data.tar.gz: 54d6e4b4907efcccc7c99cae92c6e81b7d34c172d8601faa8b9a725a2edb9590
5
5
  SHA512:
6
- metadata.gz: 821492e02d6b61f758b5e5532474bf24d3751f8d0eb1a6632b752151b337d832ad5206afa895496c6c21f2ea713eb27c5aba7af091daaab9a145536c88f6d8c5
7
- data.tar.gz: e52413eef52213b2ba746a60b3ac56771a230ce56e00dc7ae83225c8b46e1ad6ff8cb1125d0536b20a930b8210e4c0fdbc827a92ed903a052d907bf786cfa8ea
6
+ metadata.gz: 846c9daf8a830259f3919a44fe6e12f5e5911a01c63d6a3362ec7dc05bd644e332189c94e878435ca622c697d2cfd33e903f599e41cfd5b42fb6c346d81705f3
7
+ data.tar.gz: 105276a39b26b161a41cefc2b9f1ebaa989055d08d08d246927dfe1f2843c66cdaa5f4520b1ded0478d88b8d13e3b381daa9f4674fd4e1fcf8ffe1e96cbf08dc
@@ -1,4 +1,3 @@
1
- # encoding: utf-8
2
1
  #
3
2
  # Author:: Dominik Richter (<dominik.richter@gmail.com>)
4
3
 
@@ -1,4 +1,3 @@
1
- # encoding: utf-8
2
1
  #
3
2
  # Author:: Fletcher Nichol (<fnichol@nichol.ca>)
4
3
  # Author:: Dominik Richter (<dominik.richter@gmail.com>)
@@ -1,4 +1,3 @@
1
- # encoding: utf-8
2
1
  #
3
2
  # Author:: Dominik Richter (<dominik.richter@gmail.com>)
4
3
 
@@ -1,4 +1,3 @@
1
- # encoding: utf-8
2
1
  # author: Dominik Richter
3
2
  # author: Christoph Hartmann
4
3
 
@@ -1,4 +1,3 @@
1
- # encoding: utf-8
2
1
  # author: Dominik Richter
3
2
  # author: Christoph Hartmann
4
3
  module Train::Extras
@@ -1,4 +1,3 @@
1
- # encoding: utf-8
2
1
  #
3
2
  # author: Christoph Hartmann
4
3
  # author: Dominik Richter
@@ -1,5 +1,3 @@
1
- # encoding: utf-8
2
-
3
1
  module Train
4
2
  class File
5
3
  class Local < Train::File
@@ -1,5 +1,3 @@
1
- # encoding: utf-8
2
-
3
1
  require "shellwords"
4
2
  require_relative "../../extras/stat"
5
3
 
@@ -1,5 +1,3 @@
1
- # encoding: utf-8
2
-
3
1
  module Train
4
2
  class File
5
3
  class Local
@@ -1,5 +1,3 @@
1
- # encoding: utf-8
2
-
3
1
  module Train
4
2
  class File
5
3
  class Remote < Train::File
@@ -1,5 +1,3 @@
1
- # encoding: utf-8
2
-
3
1
  require_relative "unix"
4
2
 
5
3
  module Train
@@ -1,5 +1,3 @@
1
- # encoding: utf-8
2
-
3
1
  require_relative "unix"
4
2
 
5
3
  module Train
@@ -1,4 +1,3 @@
1
- # encoding: utf-8
2
1
  #
3
2
  # author: Christoph Hartmann
4
3
  # author: Dominik Richter
@@ -22,8 +22,14 @@ module Train
22
22
  def exist?
23
23
  @exist ||= begin
24
24
  f = @follow_symlink ? "" : " || test -L #{@spath}"
25
- @backend.run_command("test -e #{@spath}" + f)
26
- .exit_status == 0
25
+ if @backend.platform.solaris?
26
+ # Solaris does not support `-e` flag in default `test`,
27
+ # so we specify by running /usr/bin/test:
28
+ # https://github.com/inspec/train/issues/587
29
+ @backend.run_command("/usr/bin/test -e #{@spath}" + f)
30
+ else
31
+ @backend.run_command("test -e #{@spath}" + f)
32
+ end.exit_status == 0
27
33
  end
28
34
  end
29
35
 
@@ -1,5 +1,3 @@
1
- # encoding: utf-8
2
-
3
1
  module Train
4
2
  class File
5
3
  class Remote
@@ -1,4 +1,3 @@
1
- # encoding: utf-8
2
1
  #
3
2
  # Author:: Dominik Richter (<dominik.richter@gmail.com>)
4
3
  # Author:: Christoph Hartmann (<chris@lollyrock.com>)
@@ -1,5 +1,3 @@
1
- # encoding: utf-8
2
-
3
1
  require_relative "platforms/common"
4
2
  require_relative "platforms/detect"
5
3
  require_relative "platforms/detect/scanner"
@@ -1,5 +1,3 @@
1
- # encoding: utf-8
2
-
3
1
  module Train::Platforms
4
2
  module Common
5
3
  # Add a family connection. This will create a family
@@ -1,5 +1,3 @@
1
- # encoding: utf-8
2
-
3
1
  module Train::Platforms
4
2
  module Detect
5
3
  # Main detect method to scan all platforms for a match
@@ -34,16 +34,24 @@ module Train::Platforms::Detect::Helpers
34
34
  end
35
35
 
36
36
  def command_output(cmd)
37
- res = @backend.run_command(cmd).stdout
37
+ res = @backend.run_command(cmd)
38
+ stdout = res.stdout
39
+ stderr = res.stderr
38
40
  # When you try to execute command using ssh connction as root user and you have provided ssh user identity file
39
41
  # it gives standard output to login as authorised user other than root. To show this standard ouput as an error
40
42
  # to user we are matching the string of stdout and raising the error here so that user gets exact information.
41
- if @backend.class.to_s == "Train::Transports::SSH::Connection" && res =~ /Please login as the user/
42
- raise Train::UserError, "SSH failed: #{res}"
43
+ if @backend.class.to_s == "Train::Transports::SSH::Connection"
44
+ if stdout =~ /Please login as the user/
45
+ raise Train::UserError, "SSH failed: #{stdout}"
46
+ end
47
+
48
+ if stderr =~ /WARNING: Your password has expired/
49
+ raise Train::UserError, "SSH failed: #{stderr}"
50
+ end
43
51
  end
44
52
 
45
- res.strip! unless res.nil?
46
- res
53
+ stdout.strip! unless stdout.nil?
54
+ stdout
47
55
  end
48
56
 
49
57
  def unix_uname_s
@@ -1,5 +1,3 @@
1
- # encoding: utf-8
2
-
3
1
  module Train::Platforms::Detect::Helpers
4
2
  module Linux
5
3
  def redhatish_platform(conf)
@@ -1,5 +1,3 @@
1
- # encoding: utf-8
2
-
3
1
  require_relative "helpers/os_common"
4
2
 
5
3
  module Train::Platforms::Detect
@@ -1,5 +1,3 @@
1
- # encoding: utf-8
2
-
3
1
  module Train::Platforms::Detect::Specifications
4
2
  class Api
5
3
  def self.load
@@ -357,7 +357,7 @@ module Train::Platforms::Detect::Specifications
357
357
  declare_instance("mac_os_x", "macOS X", "darwin") do
358
358
  cmd = unix_file_contents("/System/Library/CoreServices/SystemVersion.plist")
359
359
  @platform[:uuid_command] = "system_profiler SPHardwareDataType | awk '/UUID/ { print $3; }'"
360
- cmd =~ /Mac OS X/i
360
+ cmd =~ /Mac OS X|macOS/i
361
361
  end
362
362
 
363
363
  declare_instance("darwin", "Darwin", "darwin") do
@@ -369,6 +369,7 @@ module Train::Platforms::Detect::Specifications
369
369
  declare_bsd("freebsd", "Freebsd", "bsd", /freebsd/i)
370
370
  declare_bsd("openbsd", "Openbsd", "bsd", /openbsd/i)
371
371
  declare_bsd("netbsd", "Netbsd", "bsd", /netbsd/i)
372
+ declare_bsd("dragonflybsd", "Dragonflybsd", "bsd", /dragonfly/i)
372
373
  end
373
374
 
374
375
  def self.load_other
@@ -1,5 +1,3 @@
1
- # encoding: utf-8
2
-
3
1
  module Train::Platforms
4
2
  class Family
5
3
  include Train::Platforms::Common
@@ -1,5 +1,3 @@
1
- # encoding: utf-8
2
-
3
1
  module Train::Platforms
4
2
  class Platform
5
3
  include Train::Platforms::Common
@@ -1,4 +1,3 @@
1
- # encoding: utf-8
2
1
  #
3
2
  # Author:: Dominik Richter (<dominik.richter@gmail.com>)
4
3
  # Author:: Christoph Hartmann (<chris@lollyrock.com>)
@@ -1,5 +1,3 @@
1
- # encoding: utf-8
2
-
3
1
  require_relative "../errors"
4
2
  require_relative "../extras"
5
3
  require_relative "../file"
@@ -1,4 +1,3 @@
1
- # encoding: utf-8
2
1
  #
3
2
  # Author:: Dominik Richter (<dominik.richter@gmail.com>)
4
3
  # Author:: Christoph Hartmann (<chris@lollyrock.com>)
@@ -1,5 +1,3 @@
1
- # encoding: utf-8
2
-
3
1
  class Train::Transports::SSH
4
2
  class CiscoIOSConnection < BaseConnection
5
3
  class BadEnablePassword < Train::TransportError; end
@@ -16,6 +14,9 @@ class Train::Transports::SSH
16
14
  # Use all options left that are not `nil` for `Net::SSH.start` later
17
15
  @ssh_options = options.reject { |_key, value| value.nil? }
18
16
 
17
+ # Allow older algorithms
18
+ @ssh_options[:append_all_supported_algorithms] = true
19
+
19
20
  @prompt = /^\S+[>#]\r\n.*$/
20
21
  end
21
22
 
@@ -1,4 +1,3 @@
1
- # encoding: utf-8
2
1
  #
3
2
  # author: Dominik Richter
4
3
  # author: Christoph Hartmann
@@ -1,4 +1,3 @@
1
- # encoding: utf-8
2
1
  #
3
2
  # Author:: Fletcher Nichol (<fnichol@nichol.ca>)
4
3
  # Author:: Dominik Richter (<dominik.richter@gmail.com>)
@@ -65,6 +64,9 @@ module Train::Transports
65
64
  option :non_interactive, default: false
66
65
  option :verify_host_key, default: false
67
66
 
67
+ # Allow connecting with older algorithms
68
+ option :append_all_supported_algorithms, default: true
69
+
68
70
  option :compression_level do |opts|
69
71
  # on nil or false: set compression level to 0
70
72
  opts[:compression] ? 6 : 0
@@ -76,7 +78,7 @@ module Train::Transports
76
78
  validate_options(opts)
77
79
  conn_opts = connection_options(opts)
78
80
 
79
- if defined?(@connection) && @connection_options == conn_opts
81
+ if defined?(@connection) && reusable_connection?(conn_opts)
80
82
  reuse_connection(&block)
81
83
  else
82
84
  create_new_connection(conn_opts, &block)
@@ -85,6 +87,13 @@ module Train::Transports
85
87
 
86
88
  private
87
89
 
90
+ def reusable_connection?(conn_opts)
91
+ return false unless @connection_options
92
+
93
+ # Do requested options match their current settings
94
+ @connection_options.all? { |k, v| conn_opts[k] == v }
95
+ end
96
+
88
97
  def validate_options(options)
89
98
  super(options)
90
99
 
@@ -167,6 +176,7 @@ module Train::Transports
167
176
  bastion_user: opts[:bastion_user],
168
177
  bastion_port: opts[:bastion_port],
169
178
  non_interactive: opts[:non_interactive],
179
+ append_all_supported_algorithms: opts[:append_all_supported_algorithms],
170
180
  transport_options: opts,
171
181
  }
172
182
  # disable host key verification. The hash key and value to use
@@ -1,4 +1,3 @@
1
- # encoding: utf-8
2
1
  #
3
2
  # Author:: Fletcher Nichol (<fnichol@nichol.ca>)
4
3
  # Author:: Dominik Richter (<dominik.richter@gmail.com>)
@@ -54,7 +53,7 @@ class Train::Transports::SSH
54
53
  @bastion_user = @options.delete(:bastion_user)
55
54
  @bastion_port = @options.delete(:bastion_port)
56
55
 
57
- @cmd_wrapper = CommandWrapper.load(self, @transport_options)
56
+ @cmd_wrapper = CommandWrapper.load(self, @transport_options)
58
57
  end
59
58
 
60
59
  # (see Base::Connection#close)
@@ -1,7 +1,6 @@
1
- # encoding: utf-8
2
1
  #
3
2
  # Author:: Dominik Richter (<dominik.richter@gmail.com>)
4
3
 
5
4
  module Train
6
- VERSION = "3.2.28".freeze
5
+ VERSION = "3.3.13".freeze
7
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.2.28
4
+ version: 3.3.13
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: 2020-04-13 00:00:00.000000000 Z
11
+ date: 2020-07-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: addressable
@@ -24,6 +24,20 @@ dependencies:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
26
  version: '2.5'
27
+ - !ruby/object:Gem::Dependency
28
+ name: ffi
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "!="
32
+ - !ruby/object:Gem::Version
33
+ version: 1.13.0
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "!="
39
+ - !ruby/object:Gem::Version
40
+ version: 1.13.0
27
41
  - !ruby/object:Gem::Dependency
28
42
  name: json
29
43
  requirement: !ruby/object:Gem::Requirement
@@ -73,7 +87,7 @@ dependencies:
73
87
  version: '1.2'
74
88
  - - "<"
75
89
  - !ruby/object:Gem::Version
76
- version: '3.0'
90
+ version: '4.0'
77
91
  type: :runtime
78
92
  prerelease: false
79
93
  version_requirements: !ruby/object:Gem::Requirement
@@ -83,7 +97,7 @@ dependencies:
83
97
  version: '1.2'
84
98
  - - "<"
85
99
  - !ruby/object:Gem::Version
86
- version: '3.0'
100
+ version: '4.0'
87
101
  - !ruby/object:Gem::Dependency
88
102
  name: net-ssh
89
103
  requirement: !ruby/object:Gem::Requirement
@@ -93,7 +107,7 @@ dependencies:
93
107
  version: '2.9'
94
108
  - - "<"
95
109
  - !ruby/object:Gem::Version
96
- version: '6.0'
110
+ version: '7.0'
97
111
  type: :runtime
98
112
  prerelease: false
99
113
  version_requirements: !ruby/object:Gem::Requirement
@@ -103,7 +117,7 @@ dependencies:
103
117
  version: '2.9'
104
118
  - - "<"
105
119
  - !ruby/object:Gem::Version
106
- version: '6.0'
120
+ version: '7.0'
107
121
  description: A minimal Train with a backends for ssh and winrm.
108
122
  email:
109
123
  - inspec@chef.io