Bug #18116
closedKatello::<Unit type>.import_all function breaks repository association after upgrading satellite or running reindex rake task
Description
Cloned from https://bugzilla.redhat.com/show_bug.cgi?id=1412486
Description of problem:
After upgrading to satellite 6.2.6, the repositories package count went unreasonably less in the Web UI
For example: Software collection repo only shows 30 packages
After investigating further I notice a bug in "import_all" function.
Katello::Rpm.import_all is fetching rpms from Pulp by chunk (default 100 units per chunk) and call the "sync_repository_associations" function on every chunk which breaks the repository associations in Katello. That is because "sync_repository_associations" will delete the existing associations that are not in the chunk.
For example:
Existing associations = [1, 2, 3, 4]
Pulp chunk 1 = [1, 2, 3, 5]
- Will be added
new associations = Pulp chunk 1 - Existing associations
[5] = [1, 2, 3, 5] - [1, 2, 3, 4]
- Will be deleted
old association = Existing associations - Pulp chunk 1
[4] = [1, 2, 3, 4] - [1, 2, 3, 5]
As a result the existing associations will become [1, 2, 3, 5].
Now Pulp chunk 2 = [6, 7, 8]
- Will be deleted
old association = Existing associations - Pulp chunk 2
[1, 2, 3, 5] = [1, 2, 3, 5] - [6, 7, 8]
As a result the existing associations will now become [6, 7, 8].
Version-Release number of selected component (if applicable):
6.2.6. Could also happen in the earlier versions because customer complain that it happened multiple times in different versions.
How reproducible:
Run satellite-installer --upgrade
Or
foreman-rake katello::reindex
Updated by Justin Sherrill almost 8 years ago
- Category changed from 111 to Repositories
- Assignee set to Justin Sherrill
- Target version set to 157
- Difficulty set to easy
Updated by The Foreman Bot almost 8 years ago
- Status changed from New to Ready For Testing
- Pull request https://github.com/Katello/katello/pull/6553 added
Updated by Justin Sherrill almost 8 years ago
- Translation missing: en.field_release set to 188
Updated by Justin Sherrill almost 8 years ago
- Status changed from Ready For Testing to Closed
- % Done changed from 0 to 100
Applied in changeset katello|78e9b1a5dbc1c61cbb25b1d715611d6f6d70234e.