Project

Profile

Help

Issue #1406

closed

Uploading the same Content Unit twice causes a 500 error

Added by bmbouter over 8 years ago. Updated almost 5 years ago.

Status:
CLOSED - CURRENTRELEASE
Priority:
High
Sprint/Milestone:
-
Start date:
Due date:
Estimated time:
Severity:
2. Medium
Version:
Master
Platform Release:
2.8.0
OS:
Triaged:
Yes
Groomed:
No
Sprint Candidate:
No
Tags:
Pulp 2
Sprint:
Quarter:

Description

This is problem for all content types, and this issue needs to fix them all. The goal is to make 2.8.0 behavior the same as the pre 2.8.0 behavior. I'm not sure if the second upload overwrites the first, or if it fails silently because the original is already. We need to check to make sure we do the same thing again.

Unfortunately, since the unit is saved in each plugin it likely needs to be fixed in each plugin because after the error occurs the unit still needs to be associated with the repository. Perhaps there is a way to do this in platform?

To reproduce, on a fresh installation of Pulp 2.8.0, run:

pulp-admin login -u admin -p admin
pulp-admin rpm repo create --repo-id zoo --feed http://repos.fedorapeople.org/repos/pulp/pulp/demo_repos/zoo/
wget https://repos.fedorapeople.org/repos/pulp/pulp/demo_repos/zoo/mouse-0.1.12-1.noarch.rpm
pulp-admin rpm repo uploads rpm --file ./mouse-0.1.12-1.noarch.rpm --repo-id zoo
pulp-admin rpm repo uploads rpm --file ./mouse-0.1.12-1.noarch.rpm --repo-id zoo

On the cli you'll be shown:

Task Failed

unexpected error occurred importing uploaded file

In the logs you'll see:

unexpected error occurred importing uploaded file
Traceback (most recent call last):
  File "/home/vagrant/devel/pulp_rpm/plugins/pulp_rpm/plugins/importers/yum/upload.py", line 100, in upload
    handlers[type_id](repo, type_id, unit_key, metadata, file_path, conduit, config)
  File "/home/vagrant/devel/pulp_rpm/plugins/pulp_rpm/plugins/importers/yum/upload.py", line 318, in _handle_package
    unit.save()
  File "/usr/lib/python2.7/site-packages/mongoengine/document.py", line 359, in save
    raise NotUniqueError(message %% unicode(err))
NotUniqueError: Tried to save duplicate unique keys (E11000 duplicate key error index: pulp_database.units_rpm.$name_1_epoch_1_version_1_release_1_arch_1_checksumtype_1_checksum_1 dup key: { : "mouse", : "0", : "0.1.12", : "1", : "noarch", : "sha256", : "f4200643b0845fdc55ee002c92c0404a9f3a2a49f596c78b40ab56749de226ce" })

The expectation is that there would be better error handling/reporting. There should be no traceback in the logs, and an indication should be shown to the user about why the rpm failed to upload/import.


Related issues

Related to RPM Support - Story #213: Add upload option to have an rpm/srpm/drpm/etc overwrite an existing one with the same unit_key fields (omitting checksums)CLOSED - WONTFIX

Actions
Related to RPM Support - Issue #494: better handle repositories with duplicate NVREAsCLOSED - CURRENTRELEASEipanova@redhat.comActions
Has duplicate Pulp - Issue #1473: Rpm upload fails with unknown error if you have the rpm in an orphan state.CLOSED - DUPLICATEActions

Also available in: Atom PDF