train-core 3.2.28 → 3.3.13
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.rb +0 -1
- data/lib/train/errors.rb +0 -1
- data/lib/train/extras.rb +0 -1
- data/lib/train/extras/command_wrapper.rb +0 -1
- data/lib/train/extras/stat.rb +0 -1
- data/lib/train/file.rb +0 -1
- data/lib/train/file/local.rb +0 -2
- data/lib/train/file/local/unix.rb +0 -2
- data/lib/train/file/local/windows.rb +0 -2
- data/lib/train/file/remote.rb +0 -2
- data/lib/train/file/remote/aix.rb +0 -2
- data/lib/train/file/remote/linux.rb +0 -2
- data/lib/train/file/remote/qnx.rb +0 -1
- data/lib/train/file/remote/unix.rb +8 -2
- data/lib/train/file/remote/windows.rb +0 -2
- data/lib/train/options.rb +0 -1
- data/lib/train/platforms.rb +0 -2
- data/lib/train/platforms/common.rb +0 -2
- data/lib/train/platforms/detect.rb +0 -2
- data/lib/train/platforms/detect/helpers/os_common.rb +13 -5
- data/lib/train/platforms/detect/helpers/os_linux.rb +0 -2
- data/lib/train/platforms/detect/scanner.rb +0 -2
- data/lib/train/platforms/detect/specifications/api.rb +0 -2
- data/lib/train/platforms/detect/specifications/os.rb +2 -1
- data/lib/train/platforms/family.rb +0 -2
- data/lib/train/platforms/platform.rb +0 -2
- data/lib/train/plugins.rb +0 -1
- data/lib/train/plugins/base_connection.rb +0 -2
- data/lib/train/plugins/transport.rb +0 -1
- data/lib/train/transports/cisco_ios_connection.rb +3 -2
- data/lib/train/transports/local.rb +0 -1
- data/lib/train/transports/ssh.rb +12 -2
- data/lib/train/transports/ssh_connection.rb +1 -2
- data/lib/train/version.rb +1 -2
- metadata +20 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 49d500e3ff1e260a0879ff7da716c7407934e53deef0f15df171c03cd26c9dff
|
4
|
+
data.tar.gz: 54d6e4b4907efcccc7c99cae92c6e81b7d34c172d8601faa8b9a725a2edb9590
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 846c9daf8a830259f3919a44fe6e12f5e5911a01c63d6a3362ec7dc05bd644e332189c94e878435ca622c697d2cfd33e903f599e41cfd5b42fb6c346d81705f3
|
7
|
+
data.tar.gz: 105276a39b26b161a41cefc2b9f1ebaa989055d08d08d246927dfe1f2843c66cdaa5f4520b1ded0478d88b8d13e3b381daa9f4674fd4e1fcf8ffe1e96cbf08dc
|
data/lib/train.rb
CHANGED
data/lib/train/errors.rb
CHANGED
data/lib/train/extras.rb
CHANGED
data/lib/train/extras/stat.rb
CHANGED
data/lib/train/file.rb
CHANGED
data/lib/train/file/local.rb
CHANGED
data/lib/train/file/remote.rb
CHANGED
@@ -22,8 +22,14 @@ module Train
|
|
22
22
|
def exist?
|
23
23
|
@exist ||= begin
|
24
24
|
f = @follow_symlink ? "" : " || test -L #{@spath}"
|
25
|
-
@backend.
|
26
|
-
|
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
|
|
data/lib/train/options.rb
CHANGED
data/lib/train/platforms.rb
CHANGED
@@ -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)
|
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"
|
42
|
-
|
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
|
-
|
46
|
-
|
53
|
+
stdout.strip! unless stdout.nil?
|
54
|
+
stdout
|
47
55
|
end
|
48
56
|
|
49
57
|
def unix_uname_s
|
@@ -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
|
data/lib/train/plugins.rb
CHANGED
@@ -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
|
|
data/lib/train/transports/ssh.rb
CHANGED
@@ -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) &&
|
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
|
56
|
+
@cmd_wrapper = CommandWrapper.load(self, @transport_options)
|
58
57
|
end
|
59
58
|
|
60
59
|
# (see Base::Connection#close)
|
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
|
+
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-
|
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: '
|
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: '
|
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: '
|
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: '
|
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
|