Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
Red Hat Satellite engineering is moving the tracking of its product development work on Satellite to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "Satellite project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs will be migrated starting at the end of May. If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "Satellite project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/SAT-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.

Bug 1950511

Summary: [pulp3] ISO content migration fails with ValueError: Cannot create repository version. Path is duplicated: <filename>
Product: Red Hat Satellite Reporter: Tanya Tereshchenko <ttereshc>
Component: PulpAssignee: satellite6-bugs <satellite6-bugs>
Status: CLOSED ERRATA QA Contact: Lai <ltran>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 6.9.0CC: ggainey, jjeffers, rchan, ttereshc, zhunting
Target Milestone: 6.9.2Keywords: Triaged
Target Release: Unused   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: pulp-2to3-migration-0.11.1 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2021-05-20 18:05:30 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 Tanya Tereshchenko 2021-04-16 19:01:33 UTC
Description of problem:

In Pulp 2, it seems to be possible to add N different files with the same filename (relative path) to the same repo.  
Only one is published but according to the database there are N files with the same name in one repo.  
For that reason, migration plugin tries to create a repo version with all N files with the same name.  
Here is the valid failure but the migration needs to handle it:

```
 pulp: rq.worker:ERROR: Traceback (most recent call last):
 File "/usr/lib/python3.6/site-packages/pulpcore/plugin/repo_version_utils.py", line 124, in validate_version_paths
 validate_file_paths(paths)
 File "/usr/lib/python3.6/site-packages/pulpcore/app/files.py", line 133, in validate_file_paths
 raise ValueError(_("Path is duplicated: {path}").format(path=path))
 ValueError: Path is duplicated: katello-installer-3.0.0.88.tar.gz
 During handling of the above exception, another exception occurred:
 Traceback (most recent call last):
 File "/usr/lib/python3.6/site-packages/rq/worker.py", line 936, in perform_job
 rv = job.perform()
 File "/usr/lib/python3.6/site-packages/rq/job.py", line 684, in perform
 self._result = self._execute()
 File "/usr/lib/python3.6/site-packages/rq/job.py", line 690, in _execute
 return self.func(*self.args, **self.kwargs)
 File "/usr/lib/python3.6/site-packages/pulp_2to3_migration/app/migration.py", line 194, in complex_repo_migration
 create_repo_version(progress_rv, pulp2_repo, pulp3_remote)
 File "/usr/lib/python3.6/site-packages/pulp_2to3_migration/app/migration.py", line 344, in create_repo_version
 new_version.remove_content(Content.objects.filter(pk__in=to_delete))
 File "/usr/lib/python3.6/site-packages/pulpcore/app/models/repository.py", line 795, in __exit__
 repository.finalize_new_version(self)
 File "/usr/lib/python3.6/site-packages/pulp_file/app/models.py", line 79, in finalize_new_version
 validate_repo_version(new_version)
 File "/usr/lib/python3.6/site-packages/pulpcore/plugin/repo_version_utils.py", line 139, in validate_repo_version
 validate_version_paths(version)
 File "/usr/lib/python3.6/site-packages/pulpcore/plugin/repo_version_utils.py", line 126, in validate_version_paths
 raise ValueError(_("Cannot create repository version. {err}.").format(err=e))
 ValueError: Cannot create repository version. Path is duplicated: katello-installer-3.0.0.88.tar.gz.
```


To reproduce:
 - create a pulp2 repo with 2 different files (checksum differs) which will have the same filename.
 - migrate such repo to pulp 3

Comment 2 pulp-infra@redhat.com 2021-04-16 19:17:11 UTC
The Pulp upstream bug status is at NEW. Updating the external tracker on this bug.

Comment 3 pulp-infra@redhat.com 2021-04-16 19:17:12 UTC
The Pulp upstream bug priority is at Normal. Updating the external tracker on this bug.

Comment 4 Tanya Tereshchenko 2021-04-19 10:06:03 UTC
It can only happen on a system upgraded from Sat < 6.3.
The pulp bug https://pulp.plan.io/issues/2773 which allowed files with the same name to be associated with a repo was fixed in pulp 2.13.3 (Sat 6.3). 

Updates to the steps to reproduce.

> To reproduce:
> - create a pulp2 repo with 2 different files (checksum differs) which will have the same filename.
    in Sat 6.2.

  - upgrade to Sat 6.9 

> - migrate such repo to pulp 3

Comment 5 pulp-infra@redhat.com 2021-04-29 19:13:32 UTC
The Pulp upstream bug status is at ASSIGNED. Updating the external tracker on this bug.

Comment 6 pulp-infra@redhat.com 2021-05-03 10:10:00 UTC
The Pulp upstream bug status is at POST. Updating the external tracker on this bug.

Comment 7 pulp-infra@redhat.com 2021-05-03 18:17:04 UTC
The Pulp upstream bug status is at MODIFIED. Updating the external tracker on this bug.

Comment 8 pulp-infra@redhat.com 2021-05-03 19:12:20 UTC
All upstream Pulp bugs are at MODIFIED+. Moving this bug to POST.

Comment 9 pulp-infra@redhat.com 2021-05-04 17:28:15 UTC
The Pulp upstream bug status is at CLOSED - CURRENTRELEASE. Updating the external tracker on this bug.

Comment 10 Lai 2021-05-14 21:17:46 UTC
Steps to retest.

Note: This was retested using dogfood proper which was configured to only migrate file ISOs.  Duplicated paths have been confirmed by devs, but with the fix, the errors are not shown anymore for "ValueError: Cannot create repository version. Path is duplicated: <filename>" after migration.

The proper steps to retest if need:

1. Get dogfood proper
2. Have dev configure to only migrate ISOs and restart dynflow
3. Run migration

Expected:
Migration should complete without the error "ValueError: Cannot create repository version. Path is duplicated: <filename>".

Actual:
Migration completed without the error "ValueError: Cannot create repository version. Path is duplicated: <filename>".

Verified on 6.9.2 snap 3 with python3-pulp-2to3-migration-0.11.1-1.el7pc.noarch.

Comment 15 errata-xmlrpc 2021-05-20 18:05:30 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 (Satellite 6.9.2 Async Bug Fix Update), 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/RHBA-2021:2074