Skip to content

Commit

Permalink
Fixes #36763 - Use a case statement in RHSM fact parser
Browse files Browse the repository at this point in the history
  • Loading branch information
ekohl committed Sep 21, 2023
1 parent 2efcf47 commit 57a8f55
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions app/services/katello/rhsm_fact_parser.rb
Original file line number Diff line number Diff line change
Expand Up @@ -148,26 +148,26 @@ def get_rhsm_mac(interface)
def distribution_to_puppet_os(name)
return REDHAT_ATOMIC_HOST_OS if name == REDHAT_ATOMIC_HOST_DISTRO_NAME

name = name.downcase
if name =~ /red\s*hat/
case name.downcase
when /red\s*hat/
'RedHat'
elsif name =~ /centos/
when /centos/
'CentOS'
elsif name =~ /fedora/
when /fedora/
'Fedora'
elsif name =~ /sles/ || name =~ /suse.*enterprise.*/
when /sles/, /suse.*enterprise.*/
'SLES'
elsif name =~ /debian/
when /debian/
'Debian'
elsif name =~ /ubuntu/
when /ubuntu/
'Ubuntu'
elsif name =~ /oracle/
when /oracle/
'OracleLinux'
elsif name =~ /almalinux/
when /almalinux/
'AlmaLinux'
elsif name =~ /rocky/
when /rocky/
'Rocky'
elsif name =~ /amazon/
when /amazon/
'Amazon'
else
'Unknown'
Expand Down

0 comments on commit 57a8f55

Please sign in to comment.