Skip to content

Commit 79d7207

Browse files
committed
normalize ol as oracle OS
1 parent 48a37a3 commit 79d7207

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

app/models/operating_system.rb

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ class OperatingSystem < ApplicationRecord
2828
["linux_debian", %w[debian]],
2929
["linux_esx", %w[vmnixx86 vmwareesxserver esxserver vmwareesxi]],
3030
["linux_solaris", %w[solaris]],
31-
["linux_oracle", %w[oracle]],
31+
["linux_oracle", ["oracle", /^ol/]],
3232
["linux_photon", %w[photon]],
3333
["linux_generic", %w[linux]],
3434
["unix_aix", %w[aix vios]],
@@ -79,7 +79,10 @@ def self.normalize_os_name(os_name)
7979
clean_os_name = os_name.downcase.gsub(/[^a-z0-9]/, "")
8080
OS_MAP.each do |normalized_name, candidate_names|
8181
candidate_names.each do |candidate|
82-
return normalized_name if clean_os_name.include?(candidate)
82+
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
8386
end
8487
end
8588
"unknown"

0 commit comments

Comments
 (0)