summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim Smith <tsmith@chef.io>2018-06-27 21:44:55 -0700
committerBryan McLellan <btm@loftninjas.org>2018-07-09 13:23:12 -0400
commitb6e843182a0d5bd607a799d7bf43894f921b2cbc (patch)
tree31a81d762cadf51724a046f80b7d49330d41abb6
parent451c4706cb4b38cdd98a380c8798462810ef3b6b (diff)
downloadohai-b6e843182a0d5bd607a799d7bf43894f921b2cbc.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>
-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 55d939cf..fdf8b01f 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
#