Bug 1691105

Summary: Content view version delete results in broken sym links
Product: Red Hat Satellite Reporter: Partha Aji <paji>
Component: PulpAssignee: satellite6-bugs <satellite6-bugs>
Status: CLOSED ERRATA QA Contact: Lai <ltran>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 6.5.0CC: adprice, bmbouter, daviddavis, dkliban, ggainey, ipanova, rchan, sthirugn, ttereshc, zhunting
Target Milestone: 6.5.0Keywords: Triaged
Target Release: Unused   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: pulp-rpm-2.18.1.2-1 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2019-05-14 12:40:31 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Partha Aji 2019-03-20 21:09:01 UTC
During content view publishes satellite does not generate metadata if nothing changed between the source and destination repositories. This is done to speed up capsule syncs. However this optimization breaks if there is an additional metadata file in the repo (repodata/productid for example.)

The metadata files are created as unique identifiers for every repo. This implies that every CV publish generates a new metadata file in its archived version. However since satellite only looks for rpms, distributions, errata and checksums + name for yum metadata, it does not realize that content changed. This means content generated via a CV promote will still point to content from one of the previous archives. This will lead to broken symlinks if that previous archived version is deleted.

Steps to reproduce
1) Create a repo with some yum metadata on it (https://partha.fedorapeople.org/test-repos/rpm-with-productid/) 
2) Sync the repo
3) Create a CV with that repository and publish
4) Publish the CV again and create version 2.0
5) Delete version 1.0
6) Go to the console and run the following
"foreman-rake katello:delete_orphaned_content"
7) check the following directories

ls -l /var/lib/pulp/published/yum/https/repos/Default_Organization/content_views/<cv name>/2.0/custom/<product name>/<repo name>/repodata/*product*
and 
ls -l /var/lib/pulp/published/yum/https/repos/Default_Organization/Library/<cv name>/custom/<product name>/<repo name>/repodata/*product*


Expected:
The 2 paths symlink to the same file

Actual:
The library version has a broken symlink

Comment 3 Justin Sherrill 2019-03-20 21:17:09 UTC
As a workaround after the problem occurs, simply:

Navigate to  Content > Content Views > Click your content view > find your content view version
click 'Actions' Down arrow > Regenerate Repository metadata

Comment 4 Partha Aji 2019-03-21 19:54:26 UTC
The approach to fix this involves copying yum metadata files directly instead of using symlinks. Check the associated pulp issue.

Comment 5 pulp-infra@redhat.com 2019-03-21 20:31:52 UTC
The Pulp upstream bug status is at NEW. Updating the external tracker on this bug.

Comment 6 pulp-infra@redhat.com 2019-03-21 20:31:53 UTC
The Pulp upstream bug priority is at Normal. Updating the external tracker on this bug.

Comment 7 pulp-infra@redhat.com 2019-03-22 18:31:19 UTC
The Pulp upstream bug status is at ASSIGNED. Updating the external tracker on this bug.

Comment 8 pulp-infra@redhat.com 2019-03-22 21:01:23 UTC
The Pulp upstream bug status is at POST. Updating the external tracker on this bug.

Comment 9 pulp-infra@redhat.com 2019-03-25 11:31:43 UTC
The Pulp upstream bug status is at MODIFIED. Updating the external tracker on this bug.

Comment 10 pulp-infra@redhat.com 2019-03-25 12:01:42 UTC
All upstream Pulp bugs are at MODIFIED+. Moving this bug to POST.

Comment 12 Lai 2019-04-04 19:05:47 UTC
Steps to retest:

Steps to reproduce
1) Create a repo with 2 yum metadata on it (https://partha.fedorapeople.org/test-repos/rpm-with-productid/) 
2) Sync the repo
3) Create a CV with that repository and publish
4) Publish the CV again and create version 2.0
5) Delete version 1.0
6) Go to the console and run the following
"foreman-rake katello:delete_orphaned_content"
7) check the following directories

ls -l /var/lib/pulp/published/yum/https/repos/Default_Organization/content_views/<cv name>/2.0/custom/<product name>/<repo name>/repodata/*product*
and 
ls -l /var/lib/pulp/published/yum/https/repos/Default_Organization/Library/<cv name>/custom/<product name>/<repo name>/repodata/*product*


Expected:
-bash-4.2# ls -l /var/lib/pulp/published/yum/https/repos/Default_Organization/content_views/linkTest2/4.0/custom/syslink/rpm-with-productid/repodata/
total 28K
-rw-r--r--. 1 apache apache  304 Apr  4 13:57 03973ad7700d20523f1ded1b0d0344929e5c4db47864d0aba45bd2a4c107c9d0-other.xml.gz
-rw-r--r--. 1 apache apache   24 Apr  4 13:57 73eada8d89ebc808fa71a8446e4a55b2c15a61822738f3b87ac1f7b0d30016a8-productid.gz
-rw-r--r--. 1 apache apache  124 Apr  4 13:57 a27718cc28ec6d71432e0ef3e6da544b7f9d93f6bb7d0a55aacd592d03144b70-comps.xml
-rw-r--r--. 1 apache apache  814 Apr  4 13:57 a94dcbbac2bcfb42bad521988aeb2bd7b8e0775c211990ba75814260d6041926-primary.xml.gz
-rw-r--r--. 1 apache apache  330 Apr  4 13:57 b4890b31d401ba38417ddfb132f49466dd12afe92031680ec9082bdd8685f7cc-filelists.xml.gz
-rw-r--r--. 1 apache apache   92 Apr  4 13:57 b7e270c025e7ff6a689332db48a6b7297f8b07c8059d75234e66b55f24e6d437-updateinfo.xml.gz
-rw-r--r--. 1 apache apache 2.5K Apr  4 13:58 repomd.xml
-bash-4.2# ls -l /var/lib/pulp/published/yum/https/repos/Default_Organization/Library/linkTest2/custom/syslink/rpm-with-productid/repodata/
total 28K
-rw-r--r--. 1 apache apache  304 Apr  4 13:57 03973ad7700d20523f1ded1b0d0344929e5c4db47864d0aba45bd2a4c107c9d0-other.xml.gz
-rw-r--r--. 1 apache apache   24 Apr  4 13:57 73eada8d89ebc808fa71a8446e4a55b2c15a61822738f3b87ac1f7b0d30016a8-productid.gz
-rw-r--r--. 1 apache apache  124 Apr  4 13:57 a27718cc28ec6d71432e0ef3e6da544b7f9d93f6bb7d0a55aacd592d03144b70-comps.xml
-rw-r--r--. 1 apache apache  814 Apr  4 13:57 a94dcbbac2bcfb42bad521988aeb2bd7b8e0775c211990ba75814260d6041926-primary.xml.gz
-rw-r--r--. 1 apache apache  330 Apr  4 13:57 b4890b31d401ba38417ddfb132f49466dd12afe92031680ec9082bdd8685f7cc-filelists.xml.gz
-rw-r--r--. 1 apache apache   92 Apr  4 13:57 b7e270c025e7ff6a689332db48a6b7297f8b07c8059d75234e66b55f24e6d437-updateinfo.xml.gz
-rw-r--r--. 1 apache apache 2.5K Apr  4 13:58 repomd.xml

Actual:
-bash-4.2# ls -l /var/lib/pulp/published/yum/https/repos/Default_Organization/content_views/linkTest2/4.0/custom/syslink/rpm-with-productid/repodata/
total 28K
-rw-r--r--. 1 apache apache  304 Apr  4 13:57 03973ad7700d20523f1ded1b0d0344929e5c4db47864d0aba45bd2a4c107c9d0-other.xml.gz
-rw-r--r--. 1 apache apache   24 Apr  4 13:57 73eada8d89ebc808fa71a8446e4a55b2c15a61822738f3b87ac1f7b0d30016a8-productid.gz
-rw-r--r--. 1 apache apache  124 Apr  4 13:57 a27718cc28ec6d71432e0ef3e6da544b7f9d93f6bb7d0a55aacd592d03144b70-comps.xml
-rw-r--r--. 1 apache apache  814 Apr  4 13:57 a94dcbbac2bcfb42bad521988aeb2bd7b8e0775c211990ba75814260d6041926-primary.xml.gz
-rw-r--r--. 1 apache apache  330 Apr  4 13:57 b4890b31d401ba38417ddfb132f49466dd12afe92031680ec9082bdd8685f7cc-filelists.xml.gz
-rw-r--r--. 1 apache apache   92 Apr  4 13:57 b7e270c025e7ff6a689332db48a6b7297f8b07c8059d75234e66b55f24e6d437-updateinfo.xml.gz
-rw-r--r--. 1 apache apache 2.5K Apr  4 13:58 repomd.xml
-bash-4.2# ls -l /var/lib/pulp/published/yum/https/repos/Default_Organization/Library/linkTest2/custom/syslink/rpm-with-productid/repodata/
total 28K
-rw-r--r--. 1 apache apache  304 Apr  4 13:57 03973ad7700d20523f1ded1b0d0344929e5c4db47864d0aba45bd2a4c107c9d0-other.xml.gz
-rw-r--r--. 1 apache apache   24 Apr  4 13:57 73eada8d89ebc808fa71a8446e4a55b2c15a61822738f3b87ac1f7b0d30016a8-productid.gz
-rw-r--r--. 1 apache apache  124 Apr  4 13:57 a27718cc28ec6d71432e0ef3e6da544b7f9d93f6bb7d0a55aacd592d03144b70-comps.xml
-rw-r--r--. 1 apache apache  814 Apr  4 13:57 a94dcbbac2bcfb42bad521988aeb2bd7b8e0775c211990ba75814260d6041926-primary.xml.gz
-rw-r--r--. 1 apache apache  330 Apr  4 13:57 b4890b31d401ba38417ddfb132f49466dd12afe92031680ec9082bdd8685f7cc-filelists.xml.gz
-rw-r--r--. 1 apache apache   92 Apr  4 13:57 b7e270c025e7ff6a689332db48a6b7297f8b07c8059d75234e66b55f24e6d437-updateinfo.xml.gz
-rw-r--r--. 1 apache apache 2.5K Apr  4 13:58 repomd.xml

Syslink are the same on library and content-view location.

Tested on 6.5.0 snap 22.

Comment 13 sthirugn@redhat.com 2019-04-22 21:40:20 UTC
Updated Steps to reproduce:
1) Create a repo with some yum metadata on it (https://partha.fedorapeople.org/test-repos/rpm-with-productid/) 
2) Sync the repo
3) Create a CV with that repository and publish
4) Create an include filter and have it include `lion` package (assuming you are using the repo on Step 1)
5) Publish the CV again and create version 2.0
6) Delete version 1.0
7) Go to the console and run the following
"foreman-rake katello:delete_orphaned_content"
8) check the following directories
ls -l /var/lib/pulp/published/yum/https/repos/Default_Organization/content_views/<cv name>/2.0/custom/<product name>/<repo name>/repodata/*product*
and 
ls -l /var/lib/pulp/published/yum/https/repos/Default_Organization/Library/<cv name>/custom/<product name>/<repo name>/repodata/*product*

I was able to reproduce this on 6.4.2.

Comment 17 errata-xmlrpc 2019-05-14 12:40:31 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHSA-2019:1222

Comment 18 pulp-infra@redhat.com 2019-05-22 19:31:49 UTC
The Pulp upstream bug status is at ON_QA. Updating the external tracker on this bug.

Comment 19 pulp-infra@redhat.com 2019-05-30 17:02:10 UTC
The Pulp upstream bug status is at CLOSED - CURRENTRELEASE. Updating the external tracker on this bug.