train-core 3.10.7 → 3.10.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/train/platforms/detect/helpers/os_common.rb +23 -0
- 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: bd9123fc8c77d6d2913633bb544aae171f440d3a0558bacda3136fa62d856661
|
4
|
+
data.tar.gz: b8e558c2c7fa1479725228f1745ff5ed610f6975babc43cb07bbfb6289f41806
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0ed3576117bf704f08d0170e3f9c9d08e20da634300f02b986aaa8fb18094d0b027d9943bcc04043d986102e641ed7c09a4ed163ca6b9f8de1488d3063043721
|
7
|
+
data.tar.gz: deb114924bc9f537bb8a8c4df1f0b48936c8b7e081539109b886b4c26f994a6f96b214d514d2109ab75b526e2328473fb56f323e0746a28f8cf4cfce4df8e334
|
@@ -117,6 +117,7 @@ module Train::Platforms::Detect::Helpers
|
|
117
117
|
(unix_uuid_from_chef ||
|
118
118
|
unix_uuid_from_machine_file ||
|
119
119
|
uuid_from_command ||
|
120
|
+
uuid_from_containerized_system ||
|
120
121
|
raise(Train::TransportError, "Cannot find a UUID for your node."))
|
121
122
|
end
|
122
123
|
|
@@ -155,6 +156,28 @@ module Train::Platforms::Detect::Helpers
|
|
155
156
|
uuid_from_string(result.stdout.chomp) if result.exit_status == 0 && !result.stdout.empty?
|
156
157
|
end
|
157
158
|
|
159
|
+
# This will run if anyone is running Train with local transport inside docker container
|
160
|
+
# This is fallback plan, if other ways of getting uuid fails for local transport running inside docker container
|
161
|
+
# TODO: This needs to be improved to support other container runtime
|
162
|
+
def uuid_from_containerized_system
|
163
|
+
uuid = nil
|
164
|
+
|
165
|
+
if File.exist?("/proc/self/cgroup")
|
166
|
+
cmd = @backend.run_command("head -1 /proc/self/cgroup|cut -d/ -f3")
|
167
|
+
unless cmd.stdout.strip.empty?
|
168
|
+
uuid = cmd.stdout.strip
|
169
|
+
end
|
170
|
+
end
|
171
|
+
|
172
|
+
if uuid.nil? && File.exist?("/proc/self/mountinfo")
|
173
|
+
cmd = @backend.run_command("cat /proc/self/mountinfo | grep -i /docker/containers/ | head -n 1 | awk '{print $4}' | awk NF=NF FS=/ | awk '{print $3}'")
|
174
|
+
unless cmd.stdout.strip.empty?
|
175
|
+
uuid = cmd.stdout.strip
|
176
|
+
end
|
177
|
+
end
|
178
|
+
uuid
|
179
|
+
end
|
180
|
+
|
158
181
|
# This hashes the passed string into SHA1.
|
159
182
|
# Then it downgrades the 160bit SHA1 to a 128bit
|
160
183
|
# then we format it as a valid UUIDv5.
|
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.10.
|
4
|
+
version: 3.10.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:
|
11
|
+
date: 2023-06-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: addressable
|