train-core 3.13.4 → 3.14.1
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
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 66333c4f0d4ee9976b1a803fa36db769f2763586a2d04628a091a125572e1345
|
|
4
|
+
data.tar.gz: fcabe9e05c7112a958eb4d80ea9f578434eaba6ea116bab402f0c5d46c95c2f0
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 7335b3594bc9649282d1ca2e3c2ee0e6ee5094053c7130a554f6e2fed36dfd65440d9eaa727b60a6bf78a8cbf0afe65bf1275589614826fee73c6d7fb15c8406
|
|
7
|
+
data.tar.gz: 5ebe748390217d2f1d144af77050d1d6d86ffaca03055dabbd0254e40d8a3282d239636e546fabcd3e02d5798628038e1400a3da1e6398fd81188be41956bdf5
|
data/lib/train/extras/stat.rb
CHANGED
|
@@ -34,7 +34,7 @@ module Train::Extras
|
|
|
34
34
|
|
|
35
35
|
def self.linux_stat(shell_escaped_path, backend, follow_symlink)
|
|
36
36
|
lstat = follow_symlink ? " -L" : ""
|
|
37
|
-
format = (backend.os.esx? || %w{alpine yocto ubios}.include?(backend.os[:name])) ? "-c" : "--printf"
|
|
37
|
+
format = (backend.os.esx? || %w{alpine yocto ubios}.include?(backend.os[:name]) || %w{chainguard}.include?(backend.os[:family])) ? "-c" : "--printf"
|
|
38
38
|
res = backend.run_command("stat#{lstat} #{shell_escaped_path} 2>/dev/null #{format} '%s\n%f\n%U\n%u\n%G\n%g\n%X\n%Y\n%C'")
|
|
39
39
|
# ignore the exit_code: it is != 0 if selinux labels are not supported
|
|
40
40
|
# on the system.
|
|
@@ -25,10 +25,9 @@ module Train::Platforms::Detect::Helpers
|
|
|
25
25
|
@platform[:name] = "Windows #{@platform[:release]}"
|
|
26
26
|
end
|
|
27
27
|
|
|
28
|
-
#
|
|
29
|
-
#
|
|
30
|
-
|
|
31
|
-
read_wmic
|
|
28
|
+
# Prefer retrieving the OS details via `wmic` if available on the system to retain existing behavior.
|
|
29
|
+
# If `wmic` is not available, fall back to using cmd-only commands as an alternative method.
|
|
30
|
+
wmic_available? ? read_wmic : read_cmd_os
|
|
32
31
|
true
|
|
33
32
|
end
|
|
34
33
|
|
|
@@ -243,6 +242,62 @@ module Train::Platforms::Detect::Helpers
|
|
|
243
242
|
arch_map[res.stdout.strip.to_i]
|
|
244
243
|
end
|
|
245
244
|
|
|
245
|
+
# Fallback method for reading OS info using cmd-only commands when wmic is not available
|
|
246
|
+
def read_cmd_os
|
|
247
|
+
# Try to get architecture from PROCESSOR_ARCHITECTURE environment variable
|
|
248
|
+
# This covers the same architectures as wmic CPU detection but uses environment variables
|
|
249
|
+
# which are available on all Windows versions since NT
|
|
250
|
+
arch_res = @backend.run_command("echo %PROCESSOR_ARCHITECTURE%")
|
|
251
|
+
if arch_res.exit_status == 0
|
|
252
|
+
arch_string = arch_res.stdout.strip.downcase
|
|
253
|
+
# Only set architecture if we got actual output
|
|
254
|
+
unless arch_string.empty?
|
|
255
|
+
@platform[:arch] = case arch_string
|
|
256
|
+
when "x86"
|
|
257
|
+
"i386"
|
|
258
|
+
when "amd64", "x64"
|
|
259
|
+
"x86_64"
|
|
260
|
+
when "ppc", "powerpc"
|
|
261
|
+
"powerpc"
|
|
262
|
+
else
|
|
263
|
+
# For any unknown architecture, preserve the original value
|
|
264
|
+
# This handles: arm64, ia64, arm, mips, alpha, and future architectures
|
|
265
|
+
arch_string
|
|
266
|
+
end
|
|
267
|
+
end
|
|
268
|
+
end
|
|
269
|
+
# If PROCESSOR_ARCHITECTURE fails, architecture remains unset (consistent with other methods)
|
|
270
|
+
|
|
271
|
+
# Try to get more detailed OS info from systeminfo command as fallback
|
|
272
|
+
# This is slower than wmic but works without PowerShell
|
|
273
|
+
# Only override the basic info from check_cmd if systeminfo provides better data
|
|
274
|
+
sysinfo_res = @backend.run_command("systeminfo")
|
|
275
|
+
if sysinfo_res.exit_status == 0
|
|
276
|
+
sysinfo_res.stdout.lines.each do |line|
|
|
277
|
+
line = line.strip
|
|
278
|
+
if line =~ /^OS Name:\s*(.+)$/i
|
|
279
|
+
os_name = $1.strip
|
|
280
|
+
# Only override if we get a more detailed name than the basic "Windows X.X.X" from check_cmd
|
|
281
|
+
detailed_name = os_name.gsub("Microsoft", "").strip
|
|
282
|
+
@platform[:name] = detailed_name unless detailed_name.empty?
|
|
283
|
+
elsif line =~ /^OS Version:\s*(.+)$/i
|
|
284
|
+
version_info = $1.strip
|
|
285
|
+
# Extract version number from format like "10.0.19044 N/A Build 19044"
|
|
286
|
+
if version_info =~ /^(\d+\.\d+\.\d+)/
|
|
287
|
+
# Only override release if systeminfo provides the same or more detailed version
|
|
288
|
+
systeminfo_release = $1
|
|
289
|
+
@platform[:release] = systeminfo_release if systeminfo_release
|
|
290
|
+
end
|
|
291
|
+
# Extract build number (this is additional info not available from check_cmd)
|
|
292
|
+
if version_info =~ /Build (\d+)/
|
|
293
|
+
@platform[:build] = $1
|
|
294
|
+
end
|
|
295
|
+
end
|
|
296
|
+
end
|
|
297
|
+
end
|
|
298
|
+
# If systeminfo fails, we keep the basic info from check_cmd method
|
|
299
|
+
end
|
|
300
|
+
|
|
246
301
|
def windows_uuid_from_cim
|
|
247
302
|
cmd = 'powershell -Command "(Get-CimInstance -Class Win32_ComputerSystemProduct).UUID"'
|
|
248
303
|
res = @backend.run_command(cmd)
|
|
@@ -232,6 +232,27 @@ module Train::Platforms::Detect::Specifications
|
|
|
232
232
|
end
|
|
233
233
|
end
|
|
234
234
|
|
|
235
|
+
declare_category("chainguard", "linux") do
|
|
236
|
+
rel = linux_os_release
|
|
237
|
+
rel && rel["ID"] =~ /(wolfi|chainguard)/
|
|
238
|
+
end
|
|
239
|
+
|
|
240
|
+
declare_instance("wolfi", "Wolfi Linux", "chainguard") do
|
|
241
|
+
rel = linux_os_release
|
|
242
|
+
if rel && rel["ID"] =~ /wolfi/
|
|
243
|
+
@platform[:release] = rel["VERSION_ID"]
|
|
244
|
+
true
|
|
245
|
+
end
|
|
246
|
+
end
|
|
247
|
+
|
|
248
|
+
declare_instance("chainguard", "Chainguard Linux", "chainguard") do
|
|
249
|
+
rel = linux_os_release
|
|
250
|
+
if rel && rel["ID"] =~ /chainguard/
|
|
251
|
+
@platform[:release] = rel["VERSION_ID"]
|
|
252
|
+
true
|
|
253
|
+
end
|
|
254
|
+
end
|
|
255
|
+
|
|
235
256
|
# brocade family detected here if device responds to 'uname' command,
|
|
236
257
|
# happens when logging in as root
|
|
237
258
|
plat.family("brocade").title("Brocade Family").in_family("linux")
|
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.14.1
|
|
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: 2025-
|
|
11
|
+
date: 2025-12-15 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: addressable
|
|
@@ -28,16 +28,22 @@ dependencies:
|
|
|
28
28
|
name: ffi
|
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
|
30
30
|
requirements:
|
|
31
|
-
- - "
|
|
31
|
+
- - ">="
|
|
32
32
|
- !ruby/object:Gem::Version
|
|
33
33
|
version: 1.16.0
|
|
34
|
+
- - "<"
|
|
35
|
+
- !ruby/object:Gem::Version
|
|
36
|
+
version: '1.18'
|
|
34
37
|
type: :runtime
|
|
35
38
|
prerelease: false
|
|
36
39
|
version_requirements: !ruby/object:Gem::Requirement
|
|
37
40
|
requirements:
|
|
38
|
-
- - "
|
|
41
|
+
- - ">="
|
|
39
42
|
- !ruby/object:Gem::Version
|
|
40
43
|
version: 1.16.0
|
|
44
|
+
- - "<"
|
|
45
|
+
- !ruby/object:Gem::Version
|
|
46
|
+
version: '1.18'
|
|
41
47
|
- !ruby/object:Gem::Dependency
|
|
42
48
|
name: json
|
|
43
49
|
requirement: !ruby/object:Gem::Requirement
|