From 57a8f550a099b79e4a35eabe6fb332f3a469a796 Mon Sep 17 00:00:00 2001 From: Ewoud Kohl van Wijngaarden Date: Wed, 20 Sep 2023 13:09:20 +0200 Subject: [PATCH] Fixes #36763 - Use a case statement in RHSM fact parser --- app/services/katello/rhsm_fact_parser.rb | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/app/services/katello/rhsm_fact_parser.rb b/app/services/katello/rhsm_fact_parser.rb index 9ae57a25720..ccee0443936 100644 --- a/app/services/katello/rhsm_fact_parser.rb +++ b/app/services/katello/rhsm_fact_parser.rb @@ -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'