Display custom os facts / Amazon Linux 2

Problem:
Hi there, I’ve installed subscription-manager on Amazon Linux 2, and when registering the system to Foreman, the Operating system on Foreman Interface shows as “Unknown 2”
The icon is also broken and show “icons16x16/black-%23.pngUnknown 2” On the host page, and show the operating system as Unknown 2 here :


So the major version is good but not the Main operating system.

Expected outcome:
Correct Amazon Linux OS reported

Foreman and Proxy versions:

  • foreman-2.0.3-1.el7.noarch
  • katello-3.15.3-1.el7.noarch

Distribution and version:
Katello is running on Cento

Other relevant data:
When checking the source code, I see :
katello-master3-18\katello-master\app\services\katello\candlepin\consumer.rb

        name = name.downcase
        if name =~ /red\s*hat/
          'RedHat'
        elsif name =~ /centos/
          'CentOS'
        elsif name =~ /fedora/
          'Fedora'
        elsif name =~ /sles/ || name =~ /suse.*enterprise.*/
          'SLES'
        elsif name =~ /debian/
          'Debian'
        elsif name =~ /ubuntu/
          'Ubuntu'
        elsif name =~ /oracle/
          'OracleLinux'
        else
          'Unknown'

So I guess It’s normal that the OS shows up as Unkown ?
I also saw this commit adding the Debian family :

Can I do the same for the Amazon Linux ? Do you see a problem with that ?

Kind regards,

Thomas

1 Like

I think a pull request for that makes sense.

2 Likes

I agree, maybe the code could use a bit of heuristic and it could try to capitalize the name and use that instead of Unknown as the last resort.

That’s a good idea, I could add that, I haven’t found yet how the logo is added besides the host, but we could imagine reusing the unknow logo for those who aren’t in the switch case

1 Like