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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 6d396bbb358c284289e040d532236fa26f2f92d73aa41dde56bf0b914a087238
4
- data.tar.gz: e378a5a7c8af2cc8bcadc02abc1e99c310f73a182703edac027592074dfa8eba
3
+ metadata.gz: bd9123fc8c77d6d2913633bb544aae171f440d3a0558bacda3136fa62d856661
4
+ data.tar.gz: b8e558c2c7fa1479725228f1745ff5ed610f6975babc43cb07bbfb6289f41806
5
5
  SHA512:
6
- metadata.gz: e37b9360ad1d5c206c700b770e41d552d0a864dfec0df63fde6201c7c842b3f45f9bcb0ffc2f4f6413b55d5354864eae87c1488c2c7dc31228ab9b39da5509e1
7
- data.tar.gz: 699adc38633ac5c01a0de55baa35ed4bacf060efff95a7c05d6afb324fff206c4920e29151b0ed23fb1ee2b7b4b57352323654df19a1393c2f22eae6de18678e
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
@@ -2,5 +2,5 @@
2
2
  # Author:: Dominik Richter (<dominik.richter@gmail.com>)
3
3
 
4
4
  module Train
5
- VERSION = "3.10.7".freeze
5
+ VERSION = "3.10.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.10.7
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: 2022-10-19 00:00:00.000000000 Z
11
+ date: 2023-06-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: addressable