We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents 48a37a3 + 488a238 commit a2a7b2dCopy full SHA for a2a7b2d
app/models/operating_system.rb
@@ -28,7 +28,7 @@ class OperatingSystem < ApplicationRecord
28
["linux_debian", %w[debian]],
29
["linux_esx", %w[vmnixx86 vmwareesxserver esxserver vmwareesxi]],
30
["linux_solaris", %w[solaris]],
31
- ["linux_oracle", %w[oracle]],
+ ["linux_oracle", ["oracle", /^ol/]],
32
["linux_photon", %w[photon]],
33
["linux_generic", %w[linux]],
34
["unix_aix", %w[aix vios]],
@@ -79,7 +79,10 @@ def self.normalize_os_name(os_name)
79
clean_os_name = os_name.downcase.gsub(/[^a-z0-9]/, "")
80
OS_MAP.each do |normalized_name, candidate_names|
81
candidate_names.each do |candidate|
82
- return normalized_name if clean_os_name.include?(candidate)
+ if (candidate.kind_of?(String) && clean_os_name.include?(candidate)) ||
83
+ (candidate.kind_of?(Regexp) && clean_os_name.match?(candidate))
84
+ return normalized_name
85
+ end
86
end
87
88
"unknown"
spec/models/operating_system_spec.rb
@@ -15,6 +15,8 @@
15
"linux debian" => "linux_debian",
16
"redhat coreos" => "linux_coreos",
17
"rhcos-4.11.2" => "linux_coreos",
18
+ "ol_8x64" => "linux_oracle",
19
+ "oracle" => "linux_oracle"
20
}.each do |image, expected|
21
it "normalizes #{image}" do
22
expect(described_class.normalize_os_name(image)).to eq(expected)
0 commit comments