lib/ohai/plugins/linux/platform.rb in ohai-14.6.2 vs lib/ohai/plugins/linux/platform.rb in ohai-14.8.10

- old
+ new

@@ -125,21 +125,21 @@ def determine_platform_family case platform when /debian/, /ubuntu/, /linuxmint/, /raspbian/, /cumulus/ # apt-get+dpkg almost certainly goes here "debian" - when /oracle/, /centos/, /redhat/, /scientific/, /enterpriseenterprise/, /xenserver/, /cloudlinux/, /ibm_powerkvm/, /parallels/, /nexus_centos/, /clearos/, /bigip/ # Note that 'enterpriseenterprise' is oracle's LSB "distributor ID" + when /oracle/, /centos/, /redhat/, /scientific/, /enterpriseenterprise/, /xcp/, /xenserver/, /cloudlinux/, /ibm_powerkvm/, /parallels/, /nexus_centos/, /clearos/, /bigip/ # Note that 'enterpriseenterprise' is oracle's LSB "distributor ID" # NOTE: "rhel" should be reserved exclusively for recompiled rhel versions that are nearly perfectly compatible down to the platform_version. # The operating systems that are "rhel" should all be as compatible as rhel7 = centos7 = oracle7 = scientific7 (98%-ish core RPM version compatibility # and the version numbers MUST track the upstream). The appropriate EPEL version repo should work nearly perfectly. Some variation like the # oracle kernel version differences and tuning and extra packages are clearly acceptable. Almost certainly some distros above (xenserver?) # should not be in this list. Please use fedora, below, instead. Also note that this is the only platform_family with this strict of a rule, # see the example of the debian platform family for how the rest of the platform_family designations should be used. "rhel" when /amazon/ "amazon" - when /suse/, /sles/, /opensuse/ + when /suse/, /sles/, /opensuse/, /opensuseleap/, /sled/ "suse" when /fedora/, /pidora/, /arista_eos/ # In the broadest sense: RPM-based, fedora-derived distributions which are not strictly re-compiled RHEL (if it uses RPMs, and smells more like redhat and less like # SuSE it probably goes here). "fedora" @@ -147,18 +147,20 @@ "wrlinux" when /gentoo/ "gentoo" when /slackware/ "slackware" - when /arch/ + when /arch/, /manjaro/, /antergos/ "arch" when /exherbo/ "exherbo" when /alpine/ "alpine" when /clearlinux/ "clearlinux" + when /mangeia/ + "mandriva" end end collect_data(:linux) do # platform [ and platform_version ? ] should be lower case to avoid dealing with RedHat/Redhat/redhat matching @@ -194,10 +196,13 @@ end elsif File.exist?("/etc/parallels-release") contents = File.read("/etc/parallels-release").chomp platform get_redhatish_platform(contents) platform_version contents.match(/(\d\.\d\.\d)/)[0] + elsif File.exist?("/etc/Eos-release") + platform "arista_eos" + platform_version File.read("/etc/Eos-release").strip.split[-1] elsif File.exist?("/etc/redhat-release") if os_release_file_is_cisco? # Cisco guestshell platform "nexus_centos" platform_version os_release_info["VERSION"] else @@ -222,14 +227,10 @@ platform "opensuseleap" end else platform "suse" end - elsif File.exist?("/etc/Eos-release") - platform "arista_eos" - platform_version File.read("/etc/Eos-release").strip.split[-1] - platform_family "fedora" elsif os_release_file_is_cisco? raise "unknown Cisco /etc/os-release or /etc/cisco-release ID_LIKE field" if os_release_info["ID_LIKE"].nil? || ! os_release_info["ID_LIKE"].include?("wrlinux") case os_release_info["ID"] @@ -281,18 +282,28 @@ platform "scientific" platform_version lsb[:release] elsif lsb[:id] =~ /XenServer/i platform "xenserver" platform_version lsb[:release] + elsif lsb[:id] =~ /XCP/i + platform "xcp" + platform_version lsb[:release] elsif lsb[:id] # LSB can provide odd data that changes between releases, so we currently fall back on it rather than dealing with its subtleties platform lsb[:id].downcase platform_version lsb[:release] # Use os-release (present on all modern linux distros) BUT use old *-release files as fallback. # os-release will only be used if no other *-release file is present. # We have to do this for compatibility reasons, or older OS releases might get different # "platform" or "platform_version" attributes (e.g. SLES12, RHEL7). elsif File.exist?("/etc/os-release") - platform os_release_info["ID"] == "sles" ? "suse" : os_release_info["ID"] # SLES is wrong. We call it SUSE + case os_release_info["ID"] + when "sles" + platform "suse" # SLES is wrong. We call it SUSE + when "opensuse-leap" + platform "opensuseleap" + else + platform os_release_info["ID"] + end platform_version os_release_info["VERSION_ID"] # platform_family also does not need to be hardcoded anymore. # This would be the correct way, but we stick with "determine_platform_family" for compatibility reasons. # platform_family os_release_info["ID_LIKE"] end