Bug #32533
closedDuplicate YumMetadata index entries in content view repositories causing unneeded capsule sync
Description
Description of problem:
Running foreman-rake katello:reimport script will cause Katello to index duplicate YumMetadata files into the content view repositories. These duplicate entries will cause Katello to incorrectly think the content has changed when publishing new version of the content view (matching_content: false). After that, Katello will trigger a capsule sync even the repositories aren't really changed.
Steps to Reproduce:
1. Create a content view with 1 repository (any repo with productid file). Publish the first version.
2. Create a composite content view with only the content view above. Publish the first version.
3. Now run the following command
- This will take some time as it will import all types of content
foreman-rake katello:reimport
- for quicker, you can just run the following:
foreman-rake console
Katello::YumMetadataFile.import_all
exit
4. Now publish the 2nd version of the CCV.
Actual results:
24: Actions::Katello::Repository::CheckMatchingContent (success) [ 0.29s / 0.29s ]
---
checksum_match: true
matching_content: false <========= Even the content is not changed.
Capsule sync is also triggered.
7: Actions::Pulp::Consumer::SyncCapsule (success) [ 477.46s / 21.69s ]
---
smart_proxy_history_id: 82
pulp_tasks:
...
result:
result: success
importer_id: yum_importer
exception:
repo_id: 1-ccv-rhscl-Library-76a1992b-a77f-4f52-b6a1-6b355e53a8cb
traceback:
started: '2021-05-06T04:59:45Z'
_ns: repo_sync_results
completed: '2021-05-06T05:06:42Z'
importer_type_id: yum_importer
error_message:
...
added_count: 0 <======= No update
removed_count: 0 <=======
updated_count: 0 <=======
...
result:
result: skipped <======= repo publish skipped
exception:
repo_id: 1-ccv-rhscl-Library-76a1992b-a77f-4f52-b6a1-6b355e53a8cb
started: '2021-05-06T05:06:42Z'
_ns: repo_publish_results
completed: '2021-05-06T05:06:42Z'
traceback:
distributor_type_id: yum_distributor
summary: 'Skipped: Repository content has not changed since last publish.'
error_message:
distributor_id: 1-ccv-rhscl-Library-76a1992b-a77f-4f52-b6a1-6b355e53a8cb
id: 60937962c16690717006baae
details: 'Skipped: Repository content has not changed since last publish.
Expected results:
No capsule sync is triggered
Additional info:
- foreman-rake console
repo = Katello::Repository.find_by_pulp_id("1-cv-rhscl-v7_0-76a1992b-a77f-4f52-b6a1-6b355e53a8cb")
repo.yum_metadata_files.size
=> 1
Katello::YumMetadataFile.import_all
=> nil
repo.yum_metadata_files.size
=> 2