Skip to content

Commit

Permalink
normalize ol as oracle OS
Browse files Browse the repository at this point in the history
  • Loading branch information
nasark committed Dec 4, 2024
1 parent 48a37a3 commit 79d7207
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions app/models/operating_system.rb
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ class OperatingSystem < ApplicationRecord
["linux_debian", %w[debian]],
["linux_esx", %w[vmnixx86 vmwareesxserver esxserver vmwareesxi]],
["linux_solaris", %w[solaris]],
["linux_oracle", %w[oracle]],
["linux_oracle", ["oracle", /^ol/]],
["linux_photon", %w[photon]],
["linux_generic", %w[linux]],
["unix_aix", %w[aix vios]],
Expand Down Expand Up @@ -79,7 +79,10 @@ def self.normalize_os_name(os_name)
clean_os_name = os_name.downcase.gsub(/[^a-z0-9]/, "")
OS_MAP.each do |normalized_name, candidate_names|
candidate_names.each do |candidate|
return normalized_name if clean_os_name.include?(candidate)
if (candidate.kind_of?(String) && clean_os_name.include?(candidate)) ||
(candidate.kind_of?(Regexp) && clean_os_name.match?(candidate))
return normalized_name
end
end
end
"unknown"
Expand Down

0 comments on commit 79d7207

Please sign in to comment.