Project

General

Profile

Bug #34145

Incremental publish content view doesn't copy any contents

Added by Hao Yu 8 months ago. Updated about 2 months ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
-
Target version:

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:
  1. 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 | | 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 | | 2 | Important | 0 | Copyright 2020 Red Hat Inc | 7 | t
(2 rows)

  1. 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"

  1. 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/",

  1. 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.

Associated revisions

Revision 7961da66 (diff)
Added by Hao Yu 7 months ago

Fixes #34145 - Errata href not updated (#9854)

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.

There are some advisory's fields that Katello doesn't store in the
database but Pulp does, such as version, pushcount, fromstr, rights
etc. If any of those fields is changed after syncing repo, Katello
can't detect the change and it is still referring to the orphaned
hrefs.

When user publishing an incremental content view, Katello will use the
orphaned hrefs to copy advisories from source repo to the destination
repo. If the orphaned advisories are removed by Pulp then nothing will
be copied.

History

#1 Updated by The Foreman Bot 8 months ago

  • Assignee set to Hao Yu
  • Status changed from New to Ready For Testing
  • Pull request https://github.com/Katello/katello/pull/9854 added

#2 Updated by Ryan Verdile 8 months ago

  • Triaged changed from No to Yes
  • Target version changed from Katello 4.4.0 to Katello 4.2.2

#3 Updated by The Foreman Bot 7 months ago

  • Fixed in Releases Katello 4.4.0 added

#4 Updated by Hao Yu 7 months ago

  • Status changed from Ready For Testing to Closed

#5 Updated by The Foreman Bot 7 months ago

  • Pull request https://github.com/Katello/katello/pull/9890 added

#6 Updated by The Foreman Bot 6 months ago

  • Pull request https://github.com/Katello/katello/pull/9899 added

#7 Updated by Ian Ballou 6 months ago

  • Pull request deleted (https://github.com/Katello/katello/pull/9899)

#8 Updated by The Foreman Bot 5 months ago

  • Pull request https://github.com/Katello/katello/pull/9975 added

Also available in: Atom PDF