summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorTim Smith <tsmith@chef.io>2018-06-27 21:44:55 -0700
committerTim Smith <tsmith@chef.io>2018-07-06 13:51:26 -0700
commitaf7d8766966ca0eaeb4312e7e953d7d5e207f85b (patch)
tree0da7d71ff8419b982a1c7ae662d2277f336852df /lib
parent23982962e8063853a755ce758c50620c73500b1b (diff)
downloadohai-af7d8766966ca0eaeb4312e7e953d7d5e207f85b.tar.gz
Properly detect Amazon Linux 2 final release platform version
Make the release substring on RHEL platforms optional This fixes matching the new amazon linux which is entirely different than literally every other RHEL like platform. Signed-off-by: Tim Smith <tsmith@chef.io>
Diffstat (limited to 'lib')
-rw-r--r--lib/ohai/plugins/linux/platform.rb8
1 files changed, 7 insertions, 1 deletions
diff --git a/lib/ohai/plugins/linux/platform.rb b/lib/ohai/plugins/linux/platform.rb
index 380475e3..39f2b602 100644
--- a/lib/ohai/plugins/linux/platform.rb
+++ b/lib/ohai/plugins/linux/platform.rb
@@ -24,8 +24,14 @@ Ohai.plugin(:Platform) do
contents[/^Red Hat/i] ? "redhat" : contents[/(\w+)/i, 1].downcase
end
+ # Amazon Linux AMI release 2013.09
+ # Amazon Linux 2
+ # Fedora release 28 (Twenty Eight)
+ # CentOS release 5.8 (Final)
+ # CentOS release 6.7 (Final)
+ # Red Hat Enterprise Linux Server release 7.5 (Maipo)
def get_redhatish_version(contents)
- contents[/Rawhide/i] ? contents[/((\d+) \(Rawhide\))/i, 1].downcase : contents[/release ([\d\.]+)/, 1]
+ contents[/Rawhide/i] ? contents[/((\d+) \(Rawhide\))/i, 1].downcase : contents[/(release)? ([\d\.]+)/, 2]
end
#