ohey 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: be4a504ad45c9b823a322a0188a8465c1292b134bdf7bd1b38b934603fdb673c
4
+ data.tar.gz: fe51f5f4830d81076345ca34e96a0d45468ff1b663888df46539879624972705
5
+ SHA512:
6
+ metadata.gz: 26a70e6bd74c5ca7133508314abf60111074dbc0140a1b280e7ad94645f625ef50bc4024df2aca323422e6c2aaab2654d5fd02a48d4b407f033131800497d697
7
+ data.tar.gz: 71fc54090e382023f9a88741af850c4ae50544e35fd2a72551efd36d16222f5b047b6728e278c8228a3fbb04e19661cd56f33fd51822dadcb170caf867214c99
data/CHANGELOG.md ADDED
@@ -0,0 +1,2 @@
1
+ ## 1.0.0
2
+ * Birthday!
data/Gemfile ADDED
@@ -0,0 +1,12 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gemspec
4
+
5
+ group :development, :test do
6
+ gem 'pry-byebug'
7
+ gem 'rake'
8
+ end
9
+
10
+ group :test do
11
+ gem 'rspec'
12
+ end
data/README.md ADDED
@@ -0,0 +1,48 @@
1
+ [![Build Status](https://travis-ci.com/camertron/ohey.svg?branch=master)](https://travis-ci.com/camertron/ohey)
2
+
3
+ ## ohey
4
+ A rewrite of the platform detection logic in ohai, but with fewer dependencies and 100% less metaprogramming.
5
+
6
+ ## Installation
7
+
8
+ Install ohey by running `gem install ohey` or by adding it to your Gemfile:
9
+
10
+ ```ruby
11
+ gem 'ohey', '~> 1.0'
12
+ ```
13
+
14
+ ## Usage
15
+
16
+ ### Detecting the current platform:
17
+
18
+ ```ruby
19
+ platform = Ohey.current_platform
20
+
21
+ platform.name # => "mac_os_x"
22
+ platform.family # => "mac_os_x
23
+ platform.build # => "19H1030"
24
+ platform.version # => "10.15.7"
25
+ ```
26
+
27
+ ### Registering a new platform:
28
+
29
+ ```ruby
30
+ Ohey.register_platform(:name, PlatformClass.new)
31
+ ```
32
+
33
+ The second argument must respond to the `name`, `family`, `build`, and `version` methods.
34
+
35
+ ### Listing Registered Plaforms
36
+
37
+ ```ruby
38
+ Ohey.registered_platforms # => {:darwin=>#<Ohey::Darwin:0x00007ff9d51f1ef0>, ...}
39
+ ```
40
+
41
+ ## License
42
+
43
+ Licensed under the MIT license. See LICENSE for details.
44
+
45
+ ## Authors
46
+
47
+ * The numerous authors who contributed to https://github.com/chef/ohai.
48
+ * Adapted by Cameron C. Dutro: https://github.com/camertron
data/Rakefile ADDED
@@ -0,0 +1,13 @@
1
+ require 'rspec/core/rake_task'
2
+ require 'rubygems/package_task'
3
+
4
+ require 'ohey'
5
+
6
+ Bundler::GemHelper.install_tasks
7
+
8
+ task default: :spec
9
+
10
+ desc 'Run specs'
11
+ RSpec::Core::RakeTask.new do |t|
12
+ t.pattern = './spec/**/*_spec.rb'
13
+ end
data/lib/ohey.rb ADDED
@@ -0,0 +1,65 @@
1
+ module Ohey
2
+ autoload :Aix, 'ohey/aix'
3
+ autoload :Darwin, 'ohey/darwin'
4
+ autoload :DragonflyBSD, 'ohey/dragonflybsd'
5
+ autoload :FreeBSD, 'ohey/freebsd'
6
+ autoload :Linux, 'ohey/linux'
7
+ autoload :NetBSD, 'ohey/netbsd'
8
+ autoload :OpenBSD, 'ohey/openbsd'
9
+ autoload :Solaris2, 'ohey/solaris2'
10
+ autoload :Windows, 'ohey/windows'
11
+
12
+ class << self
13
+ def current_platform
14
+ registered_platforms[os]
15
+ end
16
+
17
+ def register_platform(name, klass)
18
+ registered_platforms[name] = klass
19
+ end
20
+
21
+ def registered_platforms
22
+ @registered_platforms ||= {}
23
+ end
24
+
25
+ def os
26
+ case ::RbConfig::CONFIG['host_os']
27
+ when /aix(.+)$/
28
+ :aix
29
+ when /darwin(.+)$/
30
+ :darwin
31
+ when /linux/
32
+ :linux
33
+ when /freebsd(.+)$/
34
+ :freebsd
35
+ when /openbsd(.+)$/
36
+ :openbsd
37
+ when /netbsd(.*)$/
38
+ :netbsd
39
+ when /dragonfly(.*)$/
40
+ :dragonflybsd
41
+ when /solaris2/
42
+ :solaris2
43
+ when /mswin|mingw32|windows/
44
+ # After long discussion in IRC the "powers that be" have come to a consensus
45
+ # that no Windows platform exists that was not based on the
46
+ # Windows_NT kernel, so we herby decree that "windows" will refer to all
47
+ # platforms built upon the Windows_NT kernel and have access to win32 or win64
48
+ # subsystems.
49
+ :windows
50
+ else
51
+ ::RbConfig::CONFIG['host_os'].to_sym
52
+ end
53
+ end
54
+ end
55
+ end
56
+
57
+ Ohey.register_platform(:aix, Ohey::Aix.new)
58
+ Ohey.register_platform(:darwin, Ohey::Darwin.new)
59
+ Ohey.register_platform(:dragonflybsd, Ohey::DragonflyBSD.new)
60
+ Ohey.register_platform(:freebsd, Ohey::FreeBSD.new)
61
+ Ohey.register_platform(:linux, Ohey::Linux.new)
62
+ Ohey.register_platform(:netbsd, Ohey::NetBSD.new)
63
+ Ohey.register_platform(:openbsd, Ohey::OpenBSD.new)
64
+ Ohey.register_platform(:solaris2, Ohey::Solaris2.new)
65
+ Ohey.register_platform(:windows, Ohey::Windows.new)
data/lib/ohey/aix.rb ADDED
@@ -0,0 +1,30 @@
1
+ module Ohey
2
+ class Aix
3
+ NAME = 'aix'.freeze
4
+ FAMILY = 'aix'.freeze
5
+
6
+ def name
7
+ NAME
8
+ end
9
+
10
+ def family
11
+ FAMILY
12
+ end
13
+
14
+ def build
15
+ nil
16
+ end
17
+
18
+ def version
19
+ @version ||= begin
20
+ release = uname_rvp[0]
21
+ version = uname_rvp[1]
22
+ [version, release].join(".")
23
+ end
24
+ end
25
+
26
+ def uname_rvp
27
+ @uname_rvp ||= `uname -rvp`.split
28
+ end
29
+ end
30
+ end
@@ -0,0 +1,38 @@
1
+ module Ohey
2
+ class Darwin
3
+ NAME = 'mac_os_x'.freeze
4
+ FAMILY = 'mac_os_x'.freeze
5
+
6
+ def name
7
+ NAME
8
+ end
9
+
10
+ def family
11
+ FAMILY
12
+ end
13
+
14
+ def build
15
+ @build ||= sw_vers.each do |line|
16
+ case line
17
+ when /^BuildVersion:\s+(.+)$/
18
+ break $1
19
+ end
20
+ end
21
+ end
22
+
23
+ def version
24
+ @version ||= sw_vers.each do |line|
25
+ case line
26
+ when /^ProductVersion:\s+(.+)$/
27
+ break $1
28
+ end
29
+ end
30
+ end
31
+
32
+ private
33
+
34
+ def sw_vers
35
+ @sw_vers ||= `/usr/bin/sw_vers`.split("\n")
36
+ end
37
+ end
38
+ end
@@ -0,0 +1,31 @@
1
+ module Ohey
2
+ class DragonflyBSD
3
+ FAMILY = 'dragonflybsd'.freeze
4
+
5
+ def name
6
+ @name ||= uname_s.strip.downcase
7
+ end
8
+
9
+ def version
10
+ @version ||= uname_r.strip
11
+ end
12
+
13
+ def build
14
+ nil
15
+ end
16
+
17
+ def family
18
+ FAMILY
19
+ end
20
+
21
+ private
22
+
23
+ def uname_s
24
+ @uname_s ||= `uname -s`
25
+ end
26
+
27
+ def uname_r
28
+ @uname_r ||= `uname -r`
29
+ end
30
+ end
31
+ end
@@ -0,0 +1,31 @@
1
+ module Ohey
2
+ class FreeBSD
3
+ FAMILY = 'freebsd'.freeze
4
+
5
+ def name
6
+ @name ||= uname_s.strip.downcase
7
+ end
8
+
9
+ def version
10
+ @version ||= uname_r.strip
11
+ end
12
+
13
+ def build
14
+ nil
15
+ end
16
+
17
+ def family
18
+ FAMILY
19
+ end
20
+
21
+ private
22
+
23
+ def uname_s
24
+ @uname_s ||= `uname -s`
25
+ end
26
+
27
+ def uname_r
28
+ @uname_r ||= `uname -r`
29
+ end
30
+ end
31
+ end
data/lib/ohey/linux.rb ADDED
@@ -0,0 +1,355 @@
1
+ module Ohey
2
+ class Linux
3
+ OS_RELEASE_PATH = '/etc/os-release'.freeze
4
+ ORACLE_RELEASE_PATH = '/etc/oracle-release'.freeze
5
+ ENTERPRISE_RELEASE_PATH = '/etc/enterprise-release'.freeze
6
+ F5_RELEASE_PATH = '/etc/f5-release'.freeze
7
+ DEBIAN_VERSION_PATH = '/etc/debian_version'.freeze
8
+ PARALLELS_RELEASE_PATH = '/etc/parallels-release'.freeze
9
+ EOS_RELEASE_PATH = '/etc/Eos-release'.freeze
10
+ REDHAT_RELEASE_PATH = '/etc/redhat-release'.freeze
11
+ SYSTEM_RELEASE_PATH = '/etc/system-release'.freeze
12
+ SUSE_RELEASE_PATH = '/etc/SuSE-release'.freeze
13
+ SLACKWARE_VERSION_PATH = '/etc/slackware-version'.freeze
14
+ EXHERBO_RELEASE_PATH = '/etc/exherbo-release'.freeze
15
+ CLEARLINUX_RELEASE_PATH = '/usr/lib/os-release'.freeze
16
+
17
+ # the platform mappings between the 'ID' field in /etc/os-release and the value
18
+ # ohai uses. If you're adding a new platform here and you want to change the name
19
+ # you'll want to add it here and then add a spec for the platform_id_remap method
20
+ PLATFORM_ID_MAP = {
21
+ 'alinux' => 'alibabalinux',
22
+ 'amzn' => 'amazon',
23
+ 'archarm' => 'arch',
24
+ 'cumulus-linux' => 'cumulus',
25
+ 'ol' => 'oracle',
26
+ 'opensuse-leap' => 'opensuseleap',
27
+ 'rhel' => 'redhat',
28
+ 'sles_sap' => 'suse',
29
+ 'sles' => 'suse',
30
+ 'xenenterprise' => 'xenserver',
31
+ }
32
+
33
+ PLATFORM_ID_MAP.freeze
34
+
35
+ def name
36
+ @name ||= if os_release_exists?
37
+ platform_id_remap(os_release_info['ID'])
38
+ else
39
+ legacy_platform_detection
40
+ end
41
+ end
42
+
43
+ def family
44
+ case name
45
+ when /ubuntu/, /debian/, /linuxmint/, /raspbian/, /cumulus/, /kali/, /pop/
46
+ # apt-get+dpkg almost certainly goes here
47
+ 'debian'
48
+ when /centos/, /redhat/, /oracle/, /almalinux/, /rocky/, /scientific/, /enterpriseenterprise/, /xenserver/, /xcp-ng/, /cloudlinux/, /alibabalinux/, /sangoma/, /clearos/, /parallels/, /ibm_powerkvm/, /nexus_centos/, /bigip/ # Note that 'enterpriseenterprise' is oracle's LSB "distributor ID"
49
+ # NOTE: "rhel" should be reserved exclusively for recompiled rhel
50
+ # versions that are nearly perfectly compatible down to the
51
+ # platform_version. The operating systems that are "rhel" should
52
+ # all be as compatible as rhel7 = centos7 = oracle7 = scientific7
53
+ # (98%-ish core RPM version compatibility and the version numbers
54
+ # MUST track the upstream). The appropriate EPEL version repo should
55
+ # work nearly perfectly. Some variation like the oracle kernel
56
+ # version differences and tuning and extra packages are clearly
57
+ # acceptable. Almost certainly some distros above (xenserver?)
58
+ # should not be in this list. Please use fedora, below, instead.
59
+ # Also note that this is the only platform_family with this strict
60
+ # of a rule, see the example of the debian platform family for how
61
+ # the rest of the platform_family designations should be used.
62
+ #
63
+ # TODO: when XCP-NG 7.4 support ends we can remove the xcp-ng match.
64
+ # 7.5+ reports as xenenterprise which we remap to xenserver.
65
+ 'rhel'
66
+ when /amazon/
67
+ 'amazon'
68
+ when /suse/, /sles/, /opensuseleap/, /opensuse/, /sled/
69
+ 'suse'
70
+ when /fedora/, /arista_eos/
71
+ # In the broadest sense: RPM-based, fedora-derived distributions
72
+ # which are not strictly re-compiled RHEL (if it uses RPMs, and
73
+ # smells more like redhat and less like SuSE it probably goes here).
74
+ 'fedora'
75
+ when /nexus/, /ios_xr/
76
+ 'wrlinux'
77
+ when /gentoo/
78
+ 'gentoo'
79
+ when /arch/, /manjaro/
80
+ 'arch'
81
+ when /exherbo/
82
+ 'exherbo'
83
+ when /alpine/
84
+ 'alpine'
85
+ when /clearlinux/
86
+ 'clearlinux'
87
+ when /mangeia/
88
+ 'mandriva'
89
+ when /slackware/
90
+ 'slackware'
91
+ end
92
+ end
93
+
94
+ def build
95
+ nil
96
+ end
97
+
98
+ def version
99
+ @version ||= if os_release_exists?
100
+ # Grab the version from the VERSION_ID field and use the kernel release if that's not
101
+ # available. It should be there for everything, but rolling releases like arch / gentoo
102
+ # where we've traditionally used the kernel as the version
103
+
104
+ # centos only includes the major version in os-release for some reason
105
+ if os_release_info['ID'] == 'centos'
106
+ get_redhatish_version(redhat_release)
107
+ # debian testing and unstable don't have VERSION_ID set
108
+ elsif os_release_info['ID'] == 'debian'
109
+ os_release_info['VERSION_ID'] || debian_version
110
+ else
111
+ os_release_info['VERSION_ID'] || uname_r.strip
112
+ end
113
+ else
114
+ legacy_platform_version_detection
115
+ end
116
+ end
117
+
118
+ private
119
+
120
+ def uname_r
121
+ @uname_r ||= `/bin/uname -r`
122
+ end
123
+
124
+ def os_release_file_is_cisco?
125
+ os_release_exists? && os_release_info['CISCO_RELEASE_INFO']
126
+ end
127
+
128
+ # our platform names don't match os-release. given a time machine they would but ohai
129
+ # came before the os-release file. This method remaps the os-release names to
130
+ # the ohai names
131
+ def platform_id_remap(id)
132
+ # this catches the centos guest shell in the nexus switch which identifies itself as centos
133
+ return "nexus_centos" if id == "centos" && os_release_file_is_cisco?
134
+
135
+ PLATFORM_ID_MAP[id.downcase] || id.downcase
136
+ end
137
+
138
+ def read_release_info(file)
139
+ return nil unless File.exist?(file)
140
+
141
+ File.read(file).split.inject({}) do |map, line|
142
+ key, value = line.split("=")
143
+ map[key] = value.gsub(/\A"|"\Z/, "") if value
144
+ map
145
+ end
146
+ end
147
+
148
+ def os_release_info
149
+ @os_release_info ||= read_release_info(OS_RELEASE_PATH).tap do |release_info|
150
+ cisco_release_info = release_info['CISCO_RELEASE_INFO'] if release_info
151
+
152
+ if cisco_release_info && File.exist?(cisco_release_info)
153
+ release_info.merge!(read_os_release_info(cisco_release_info))
154
+ end
155
+ end
156
+ end
157
+
158
+ def os_release_exists?
159
+ File.exist?(OS_RELEASE_PATH)
160
+ end
161
+
162
+ def lsb
163
+ @lsb ||= {}.tap do |attrs|
164
+ lsb_release_a.split("\n").each do |line|
165
+ case line
166
+ when /^Distributor ID:\s+(.+)/
167
+ attrs[:id] = $1
168
+ when /^Description:\s+(.+)/
169
+ attrs[:description] = $1
170
+ when /^Release:\s+(.+)/
171
+ attrs[:release] = $1
172
+ when /^Codename:\s+(.+)/
173
+ attrs[:codename] = $1
174
+ else
175
+ attrs[:id] = line
176
+ end
177
+ end
178
+ end
179
+ end
180
+
181
+ def lsb_release_a
182
+ @lsb_release_a ||= `lsb_release -a`
183
+ end
184
+
185
+ def bigip_version
186
+ f5_release.match(/BIG-IP release (\S*)/)[1] # http://rubular.com/r/O8nlrBVqSb
187
+ rescue NoMethodError, Errno::ENOENT, Errno::EACCES # rescue regex failure, file missing, or permission denied
188
+ puts 'Detected F5 Big-IP, but /etc/f5-release could not be parsed to determine platform_version'
189
+ nil
190
+ end
191
+
192
+ def oracle_release
193
+ @oracle_release ||= File.read(ORACLE_RELEASE_PATH).chomp
194
+ end
195
+
196
+ def enterprise_release
197
+ @enterprise_release ||= File.read(ENTERPRISE_RELEASE_PATH).chomp
198
+ end
199
+
200
+ def f5_release
201
+ @f5_release ||= File.read(F5_RELEASE_PATH)
202
+ end
203
+
204
+ def debian_version
205
+ @debian_version ||= File.read(DEBIAN_VERSION_PATH).chomp
206
+ end
207
+
208
+ def parallels_release
209
+ @parallels_release ||= File.read(PARALLELS_RELEASE_PATH).chomp
210
+ end
211
+
212
+ def eos_release
213
+ @eos_release ||= File.read(EOS_RELEASE_PATH)
214
+ end
215
+
216
+ def redhat_release
217
+ @redhat_release ||= File.read(REDHAT_RELEASE_PATH).chomp
218
+ end
219
+
220
+ def system_release
221
+ @system_release ||= File.read(SYSTEM_RELEASE_PATH).chomp
222
+ end
223
+
224
+ def suse_release
225
+ @suse_release ||= File.read(SUSE_RELEASE_PATH)
226
+ end
227
+
228
+ def slackware_version
229
+ @slackware_version ||= File.read(SLACKWARE_VERSION_PATH)
230
+ end
231
+
232
+ def clearlinux_release
233
+ @clearlinux_release ||= File.read(CLEARLINUX_RELEASE_PATH)
234
+ end
235
+
236
+ def get_redhatish_platform(contents)
237
+ contents[/^Red Hat/i] ? 'redhat' : contents[/(\w+)/i, 1].downcase
238
+ end
239
+
240
+ def get_redhatish_version(contents)
241
+ contents[/(release)? ([\d\.]+)/, 2]
242
+ end
243
+
244
+ def legacy_platform_detection
245
+ # platform [ and platform_version ? ] should be lower case to avoid dealing with RedHat/Redhat/redhat matching
246
+ if File.exist?(ORACLE_RELEASE_PATH) || File.exist?(ENTERPRISE_RELEASE_PATH)
247
+ 'oracle'
248
+ elsif File.exist?(F5_RELEASE_PATH)
249
+ 'bigip'
250
+ elsif File.exist?(DEBIAN_VERSION_PATH)
251
+ # Ubuntu and Debian both have /etc/debian_version
252
+ # Ubuntu should always have a working lsb, debian does not by default
253
+ /Ubuntu/i.match?(lsb[:id]) ? 'ubuntu' : 'debian'
254
+ elsif File.exist?(PARALLELS_RELEASE_PATH)
255
+ get_redhatish_platform(parallels_release)
256
+ elsif File.exist?(EOS_RELEASE_PATH)
257
+ 'arista_eos'
258
+ elsif File.exist?(REDHAT_RELEASE_PATH)
259
+ get_redhatish_platform(redhat_release)
260
+ elsif File.exist?(SYSTEM_RELEASE_PATH)
261
+ get_redhatish_platform(system_release)
262
+ elsif File.exist?(SUSE_RELEASE_PATH)
263
+ if /^openSUSE/.match?(suse_release)
264
+ # opensuse releases >= 42 are openSUSE Leap
265
+ if version.to_i < 42
266
+ 'opensuse'
267
+ else
268
+ 'opensuseleap'
269
+ end
270
+ else
271
+ 'suse'
272
+ end
273
+ elsif os_release_file_is_cisco?
274
+ if os_release_info['ID_LIKE'].nil? || !os_release_info['ID_LIKE'].include?('wrlinux')
275
+ raise 'unknown Cisco /etc/os-release or /etc/cisco-release ID_LIKE field'
276
+ end
277
+
278
+ case os_release_info['ID']
279
+ when 'nexus'
280
+ 'nexus'
281
+ when 'ios_xr'
282
+ 'ios_xr'
283
+ else
284
+ raise 'unknown Cisco /etc/os-release or /etc/cisco-release ID field'
285
+ end
286
+ elsif File.exist?(SLACKWARE_VERSION_PATH)
287
+ 'slackware'
288
+ elsif File.exist?(EXHERBO_RELEASE_PATH)
289
+ 'exherbo'
290
+ elsif File.exist?(CLEARLINUX_RELEASE_PATH)
291
+ # Clear Linux https://clearlinux.org/
292
+ if /clear-linux-os/.match?(clearlinux_release)
293
+ 'clearlinux'
294
+ end
295
+ elsif /RedHat/i.match?(lsb[:id])
296
+ 'redhat'
297
+ elsif /Amazon/i.match?(lsb[:id])
298
+ 'amazon'
299
+ elsif /ScientificSL/i.match?(lsb[:id])
300
+ 'scientific'
301
+ elsif /XenServer/i.match?(lsb[:id])
302
+ 'xenserver'
303
+ elsif lsb[:id]
304
+ # LSB can provide odd data that changes between releases, so we currently fall back on it
305
+ # rather than dealing with its subtleties
306
+ lsb[:id].downcase
307
+ end
308
+ end
309
+
310
+ def legacy_platform_version_detection
311
+ # platform [ and platform_version ? ] should be lower case to avoid dealing with RedHat/Redhat/redhat matching
312
+ if File.exist?(ORACLE_RELEASE_PATH)
313
+ get_redhatish_version(oracle_release)
314
+ elsif File.exist?(ENTERPRISE_RELEASE_PATH)
315
+ get_redhatish_version(enterprise_release)
316
+ elsif File.exist?(F5_RELEASE_PATH)
317
+ bigip_version
318
+ elsif File.exist?(DEBIAN_VERSION_PATH)
319
+ # Ubuntu and Debian both have /etc/debian_version
320
+ # Ubuntu should always have a working lsb, debian does not by default
321
+ if /Ubuntu/i.match?(lsb[:id])
322
+ lsb[:release]
323
+ else
324
+ debian_version
325
+ end
326
+ elsif File.exist?(PARALLELS_RELEASE_PATH)
327
+ parallels_release.match(/(\d\.\d\.\d)/)[0]
328
+ elsif File.exist?(EOS_RELEASE_PATH)
329
+ eos_release.strip.split[-1]
330
+ elsif File.exist?(REDHAT_RELEASE_PATH)
331
+ get_redhatish_version(redhat_release)
332
+ elsif File.exist?(SYSTEM_RELEASE_PATH)
333
+ get_redhatish_version(system_release)
334
+ elsif File.exist?(SUSE_RELEASE_PATH)
335
+ suse_version = suse_release.scan(/VERSION = (\d+)\nPATCHLEVEL = (\d+)/).flatten.join(".")
336
+ suse_version = suse_release[/VERSION = ([\d\.]{2,})/, 1] if suse_version == ''
337
+ suse_version
338
+ elsif os_release_file_is_cisco?
339
+ os_release_info['VERSION']
340
+ elsif File.exist?(SLACKWARE_VERSION_PATH)
341
+ slackware_version.scan(/(\d+|\.+)/).join
342
+ elsif File.exist?(EXHERBO_RELEASE_PATH)
343
+ # no way to determine platform_version in a rolling release distribution
344
+ # kernel release will be used - ex. 3.13
345
+ uname_r.strip
346
+ elsif File.exist?(CLEARLINUX_RELEASE_PATH)
347
+ if /clear-linux-os/.match?(clearlinux_release) # Clear Linux https://clearlinux.org/
348
+ clearlinux_release[/VERSION_ID=(\d+)/, 1]
349
+ end
350
+ else
351
+ lsb[:release]
352
+ end
353
+ end
354
+ end
355
+ end