summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim Smith <tsmith@chef.io>2017-07-19 10:02:33 -0700
committerTim Smith <tsmith@chef.io>2017-07-19 10:02:33 -0700
commit1cccf0b0e0ec12a2276ce586ca58ba4b9e6472c4 (patch)
tree6c14808e8111c6cbd8d5fcdbae22e21be7319462
parent44974f03f6810cc1d37fce3b922d89600c6088b9 (diff)
downloadohai-1cccf0b0e0ec12a2276ce586ca58ba4b9e6472c4.tar.gz
Detect F5 Big-IPs as platform bigip
They're RHEL + a bunch of secret sauce. Put them in the RHEL platform family, detect the platform properly, and parse the platform version so it doesn't get the RHEL platform version instead. Signed-off-by: Tim Smith <tsmith@chef.io>
-rw-r--r--lib/ohai/plugins/linux/platform.rb18
1 files changed, 17 insertions, 1 deletions
diff --git a/lib/ohai/plugins/linux/platform.rb b/lib/ohai/plugins/linux/platform.rb
index a926f40f..d8048eae 100644
--- a/lib/ohai/plugins/linux/platform.rb
+++ b/lib/ohai/plugins/linux/platform.rb
@@ -86,6 +86,19 @@ Ohai.plugin(:Platform) do
end
#
+ # Determines the platform version for F5 Big-IP systems
+ #
+ # @returns [String] bigip Linux version from /etc/f5-release
+ #
+ def bigip_version
+ release_contents = File.read("/etc/f5-release")
+ release_contents.match(/BIG-IP release (\S*)/)[1] # http://rubular.com/r/O8nlrBVqSb
+ rescue NoMethodError, Errno::ENOENT, Errno::EACCES # rescue regex failure, file missing, or permission denied
+ Ohai::Log.warn("Detected F5 Big-IP, but /etc/f5-release could not be parsed to determine platform_version")
+ nil
+ end
+
+ #
# Determines the platform version for Debian based systems
#
# @returns [String] version of the platform
@@ -107,7 +120,7 @@ Ohai.plugin(:Platform) do
case platform
when /debian/, /ubuntu/, /linuxmint/, /raspbian/, /cumulus/
"debian"
- when /oracle/, /centos/, /redhat/, /scientific/, /enterpriseenterprise/, /xenserver/, /cloudlinux/, /ibm_powerkvm/, /parallels/, /nexus_centos/, /clearos/ # Note that 'enterpriseenterprise' is oracle's LSB "distributor ID"
+ when /oracle/, /centos/, /redhat/, /scientific/, /enterpriseenterprise/, /xenserver/, /cloudlinux/, /ibm_powerkvm/, /parallels/, /nexus_centos/, /clearos/, /bigip/ # Note that 'enterpriseenterprise' is oracle's LSB "distributor ID"
"rhel"
when /amazon/
"amazon"
@@ -142,6 +155,9 @@ Ohai.plugin(:Platform) do
contents = File.read("/etc/enterprise-release").chomp
platform "oracle"
platform_version get_redhatish_version(contents)
+ elsif File.exist?("/etc/f5-release")
+ platform "bigip"
+ platform_version bigip_version
elsif File.exist?("/etc/debian_version")
# Ubuntu and Debian both have /etc/debian_version
# Ubuntu should always have a working lsb, debian does not by default