Description of problem:
This is based on SAT-36540, but can occur in other cases too.
Foreman will try to find the OS when Puppet facts are uploaded. If it doesn't exist then it creates an entry. https://github.com/theforeman/foreman/blob/49dd22221ed4ba4d7687e3e7406d8ae975a2ffa9/app/services/puppet_fact_parser.rb#L7-L27
There are 2 unique constraints on OperatingSystem (https://github.com/theforeman/foreman/blob/49dd22221ed4ba4d7687e3e7406d8ae975a2ffa9/db/migrate/20150713143226_add_unique_to_operatingsystems_title.rb#L3-L5):
- name, major, minor
- title
The fact parser only deals with the first, but can then fail on creating the OS when the title is already taken.
How reproducible:
Always
Is this issue a regression from an earlier version:
No, this has been a long standing problem
Steps to Reproduce:
This is from memory, exact steps may be a bit different.
1. Create an OS with:
- name: RedHat
- major: 9 (or whatever matches your host OS)
- minor: 7 (or whatever matches your host OS)
- description: RHEL 9.7
2. Ensure no OS exists with name RHEL & major 9 & minor 7
3. Run the installer on a RHEL 9.7 Satellite server
Actual behavior:
It fails with (ActiveRecord::RecordInvalid): Validation failed: Title has already been taken
Expected behavior:
It picks up the existing OS with the same description.
Business Impact / Additional info:
Customers running Leapp to upgrade their Satellite often run into problems, but it can also surface for Puppet users.
https://github.com/Katello/katello/blob/942b2ccff2af9cbf43a14e43afda8f8789cee5b0/app/models/katello/concerns/redhat_extensions.rb#L8 can also create the OS with name RedHat.
- is triggered by
-
SAT-36540 When installing satellite, the default Operating System will be created, and it will be something like "RHEL", instead of "RedHat"
-
- Backlog
-