diff options
author | Tim Smith <tsmith@chef.io> | 2021-03-12 23:27:40 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-03-12 23:27:40 -0800 |
commit | f6c92db53362b5a342da072d4e4d96e4a0391cf7 (patch) | |
tree | 20f40998d3043fabb1cef762328b578c01e95433 | |
parent | 21313a9566345153bbecf2a228cca442c3e1da1f (diff) | |
parent | dd9557b308df809c7be6d196de0e492857b3087c (diff) | |
download | ohai-f6c92db53362b5a342da072d4e4d96e4a0391cf7.tar.gz |
Merge pull request #1632 from chef/xcp
Signed-off-by: Tim Smith <tsmith@chef.io>
-rw-r--r-- | lib/ohai/plugins/linux/platform.rb | 15 | ||||
-rw-r--r-- | spec/unit/plugins/linux/platform_spec.rb | 5 |
2 files changed, 12 insertions, 8 deletions
diff --git a/lib/ohai/plugins/linux/platform.rb b/lib/ohai/plugins/linux/platform.rb index 46b9b161..15876e07 100644 --- a/lib/ohai/plugins/linux/platform.rb +++ b/lib/ohai/plugins/linux/platform.rb @@ -54,7 +54,7 @@ Ohai.plugin(:Platform) do end # - # Cached /etc/os-release info Hash. Also has logic for Cisco Nexus + # Cached /etc/os-release info Hash. Also has logic for Cisco Nexus # switches that pulls the chained CISCO_RELEASE_INFO file into the Hash (other # distros can also reuse this method safely). # @@ -122,7 +122,7 @@ Ohai.plugin(:Platform) do "sles_sap" => "suse", "sles" => "suse", "xenenterprise" => "xenserver", - }[id] || id + }[id.downcase] || id.downcase end # @@ -137,13 +137,15 @@ Ohai.plugin(:Platform) do when /debian/, /ubuntu/, /linuxmint/, /raspbian/, /cumulus/, /kali/, /pop/ # apt-get+dpkg almost certainly goes here "debian" - when /oracle/, /centos/, /redhat/, /almalinux/, /scientific/, /enterpriseenterprise/, /xcp/, /xenserver/, /cloudlinux/, /ibm_powerkvm/, /parallels/, /nexus_centos/, /clearos/, /bigip/, /alibabalinux/, /sangoma/ # Note that 'enterpriseenterprise' is oracle's LSB "distributor ID" + when /oracle/, /centos/, /redhat/, /almalinux/, /scientific/, /enterpriseenterprise/, /xenserver/, /xcp-ng/, /cloudlinux/, /ibm_powerkvm/, /parallels/, /nexus_centos/, /clearos/, /bigip/, /alibabalinux/, /sangoma/ # 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, + # 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. + # + # TODO: when XCP-NG 7.4 support ends we can remove the xcp-ng match. 7.5+ reports as xenenterprise which we remap to xenserver "rhel" when /amazon/ "amazon" @@ -271,9 +273,6 @@ Ohai.plugin(:Platform) do elsif /XenServer/i.match?(lsb[:id]) platform "xenserver" platform_version lsb[:release] - elsif /XCP/i.match?(lsb[:id]) - 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] diff --git a/spec/unit/plugins/linux/platform_spec.rb b/spec/unit/plugins/linux/platform_spec.rb index 17ce8c2f..33d3bb90 100644 --- a/spec/unit/plugins/linux/platform_spec.rb +++ b/spec/unit/plugins/linux/platform_spec.rb @@ -127,6 +127,11 @@ describe Ohai::System, "Linux plugin platform" do expect(plugin.platform_id_remap("cumulus-linux")).to eq("cumulus") end + # See https://github.com/chef/os_release/blob/master/xcp-ng_7_4#L3 for an example of why we do this + it "returns a downcased ID value" do + expect(plugin.platform_id_remap("XCP-ng")).to eq("xcp-ng") + end + it "does not transformation for any other platform" do expect(plugin.platform_id_remap("ubuntu")).to eq("ubuntu") end |