Bug #34145
closedIncremental publish content view doesn't copy any contents
Description
Clone from https://bugzilla.redhat.com/show_bug.cgi?id=2032098
After publishing an incremental content view, the content count remain the same as previous version. The specified errata are not copy to the latest published version.
This is because Katello database is still storing to the errata with old href which have been deleted by Pulp (delete orphan). When Katello instructs Pulp to copy those errata, nothing will be copy because they are no longer exist in Pulp.
Like any other content in Pulp 3, advisories are immutable. So when there is some change to it, a new one is created, it is then associated to a repository as a part of a new repository version and the old one is unassociated and becomes orphaned.
They are some errata/advisory's fields that Katello doesn't store in its database but Pulp does, such as version, pushcount, fromstr, rights etc. When one of those field changed after syncing the repo, Katello can't notice the change and "index_content" will not update the hrefs.
For example:- The version of the RHSA-2020:3220 has bumped up to version '2' but other fields, such as updated_date remain unchanged.
pulpcore=# select content_ptr_id, id, updated_date, issued_date, title, status, fromstr, version, severity, release,rights, pushcount, reboot_suggested from rpm_updaterecord where content_ptr_id in ('10dd841a-c411-41e1-9e3e-9b3021877daa', 'c9404462-9edb-4cef-9632-b59268e673fa');
content_ptr_id | id | updated_date | issued_date | title | status | fromstr | version | severity
| release | rights | pushcount | reboot_suggested
--------------------------------------+----------------+---------------------+---------------------+-----------------------------------------------+--------+--------------------------------+---------+----------------------------------------------+-----------+------------------
10dd841a-c411-41e1-9e3e-9b3021877daa | RHSA-2020:3220 | 2020-07-29 17:19:23 | 2020-07-29 17:19:38 | Important: kernel security and bug fix update | final | release-engineering@redhat.com | 1 | Important
| 0 | Copyright 2020 Red Hat Inc | 7 | t
c9404462-9edb-4cef-9632-b59268e673fa | RHSA-2020:3220 | 2020-07-29 17:19:23 | 2020-07-29 17:19:38 | Important: kernel security and bug fix update | final | release-engineering@redhat.com | 2 | Important
| 0 | Copyright 2020 Red Hat Inc | 7 | t
(2 rows)
- However, we can see that Katello is still referring the old href.
irb(main):128:0> pp Katello::RepositoryErratum.find(2888951)
#<Katello::RepositoryErratum:0x000000000da40e40
id: 2888951,
erratum_id: 50031,
repository_id: 1,
created_at: Wed, 24 Nov 2021 01:48:03 UTC +00:00,
updated_at: Wed, 24 Nov 2021 01:48:03 UTC +00:00,
erratum_pulp3_href:
"/pulp/api/v3/content/rpm/advisories/10dd841a-c411-41e1-9e3e-9b3021877daa/"> <======== The new one should be "c9404462-9edb-4cef-9632-b59268e673fa"
- The repository is a library instance
irb(main):131:0> pp Katello::RepositoryErratum.find(2888951).repository
#<Katello::Repository:0x000000000984d740
id: 1,
pulp_id:
"Default_Organization-Red_Hat_Enterprise_Linux_Server-Red_Hat_Enterprise_Linux_7_Server_RPMs_x86_64_7Server",
library_instance_id: nil,
content_view_version_id: 1,
relative_path:
"Default_Organization/Library/content/dist/rhel/server/7/7Server/x86_64/os",
environment_id: 1,
saved_checksum_type: "sha1",
distribution_version: nil,
distribution_arch: nil,
distribution_bootable: nil,
distribution_family: nil,
distribution_variant: nil,
container_repository_name: nil,
root_id: 1,
remote_href:
"/pulp/api/v3/remotes/rpm/rpm/8c9ff859-90a4-4885-ba3f-238fd878eb6a/",
publication_href:
"/pulp/api/v3/publications/rpm/rpm/2e694e90-5e43-42c7-9f8f-3f61314115c4/",
version_href:
"/pulp/api/v3/repositories/rpm/rpm/4aeedada-9a72-4570-8498-8ffaf1bcbf78/versions/4/",
- As we can see below "/pulp/api/v3/repositories/rpm/rpm/4aeedada-9a72-4570-8498-8ffaf1bcbf78/versions/4/" is associated to RHSA-2020:3220 version '2'.
pulpcore=# select rc.repository_id, rc.content_id, v.pulp_id as version_pulp_id, v.number, v.complete from core_repositorycontent rc left join core_repositoryversion v on v.pulp_id = rc.version_added_id where content_id = 'c9404462-9edb-4cef-9632-b59268e673fa' and rc.repository_id = '4aeedada-9a72-4570-8498-8ffaf1bcbf78';
repository_id | content_id | version_pulp_id | number | complete
--------------------------------------+--------------------------------------+--------------------------------------+--------+----------
4aeedada-9a72-4570-8498-8ffaf1bcbf78 | c9404462-9edb-4cef-9632-b59268e673fa | 83c626e6-b5d1-4f2c-be8e-b8f5e0a3acd9 | 4 | t
(1 row)
Index content method should check if the href of a unit has been changed and update it accordingly.
This issue might also affect other functionality that need to copy content from source to destination repos, such as content view filter.