Bug #35848
closedDuplicate RepositorySet when manifest updated.
Description
Description of problem:
Whenever a manifest is uploaded the candlepin instance refreshes its products and contents accordingly. Katello then refreshes its tables based on candlepin data.
This works well if new content is added. But in some instances the provided manifest content may have moved from one product to another. The sat indexing logic does not appropriately handle this scenario causing duplicate repository sets.
Version-Release number of selected component (if applicable):
How reproducible:
Always
Steps to Reproduce:
To simulate this requires 2 manifests where content has been switched from one product to another.
manifest-1.zip - rhceph-4-tools-for-rhel-8-x86_64-rpms content is in "Red Hat Enterprise Linux for x86_64"
manifest-2.zip - rhceph-4-tools-for-rhel-8-x86_64-rpms content is in "Red Hat Ceph Storage"
1. Add the following section to your /etc/foreman/plugins/katello.yaml (under section katello)
:katello:
:force_manifest_import: SIGNATURE_CONFLICT&force=MANIFEST_SAME
..other entries..
Since manifest-2 is a fake manifest we need this entry to disable import checks by candlepin.
2. "foreman-maintain service restart" for the new config to take affect
3. Import manifest-1.zip
4. Import manifest-2.zip
5. Go to Red Hat repositories page
6. search for "content_label=rhceph-4-tools-for-rhel-8-x86_64-rpms"
Actual results:
You see 2 repository sets with that label.
Enabling repo("rhceph-4-tools-for-rhel-8-x86_64-rpms") via ansible-playbook/hammer label name fails with the below error:-
Exception
~~~~~~~~~~~~
failed: [satellite.example.com -> localhost] (item={'label': 'rhceph-4-tools-for-rhel-8-x86_64-rpms'}) => {"ansible_loop_var": "item", "changed": false, "item": {"label": "rhceph-4-tools-for-rhel-8-x86_64-rpms"}, "msg": "Found too many (2) results while searching for repository_sets with label=\"rhceph-4-tools-for-rhel-8-x86_64-rpms\""}
~~~~~~~~~~~~
Expected results:
Only one entry for repository set with the given label. The manifest indexing process should clear out the product content (ideally.)