Project

Profile

Help

Issue #3436

closed

Creating duplicate content results in 500 IntegrityError

Added by daviddavis over 6 years ago. Updated over 4 years ago.

Status:
CLOSED - CURRENTRELEASE
Priority:
Normal
Assignee:
Sprint/Milestone:
Start date:
Due date:
Estimated time:
Severity:
3. High
Platform Release:
OS:
Triaged:
Yes
Groomed:
No
Sprint Candidate:
Yes
Tags:
Sprint:
Sprint 46
Quarter:

Description

$ http POST http://localhost:8000/api/v3/content/file/ relative_path=hello.tar.gz artifact="http://localhost:8000/api/v3/artifacts/79993432-e329-4bef-86bb-9bd481cee489/"   [392/1963]
HTTP/1.0 201 Created
Allow: GET, POST, HEAD, OPTIONS
Content-Length: 226
Content-Type: application/json
Date: Tue, 06 Mar 2018 19:33:49 GMT
Server: WSGIServer/0.2 CPython/3.5.4
Vary: Accept, Cookie
X-Frame-Options: SAMEORIGIN

{
    "_href": "http://localhost:8000/api/v3/content/file/db0dc6fe-d0c0-445c-af08-cd38aa9f4c42/",
    "artifact": "http://localhost:8000/api/v3/artifacts/79993432-e329-4bef-86bb-9bd481cee489/",
    "relative_path": "hello.tar.gz",
    "type": "file"
}

$ http POST http://localhost:8000/api/v3/content/file/ relative_path=hello.tar.gz artifact="http://localhost:8000/api/v3/artifacts/79993432-e329-4bef-86bb-9bd481cee489/"
HTTP/1.0 500 Internal Server Error
Content-Length: 23305
Content-Type: text/plain
Date: Tue, 06 Mar 2018 19:33:53 GMT
Server: WSGIServer/0.2 CPython/3.5.4
Vary: Cookie
X-Frame-Options: SAMEORIGIN

IntegrityError at /api/v3/content/file/
UNIQUE constraint failed: pulp_file_filecontent.relative_path, pulp_file_filecontent.digest

Related issues

Related to Pulp - Test #4125: Test if creating duplicate content results in 400 CLOSED - COMPLETEkersomActions
Actions #1

Updated by dalley over 6 years ago

  • Severity changed from 2. Medium to 3. High
  • Triaged changed from No to Yes
  • Tags Pulp 3 added
Actions #2

Updated by dkliban@redhat.com over 6 years ago

  • Sprint Candidate changed from No to Yes
Actions #3

Updated by CodeHeeler over 6 years ago

  • Status changed from NEW to ASSIGNED
  • Assignee set to CodeHeeler
Actions #4

Updated by dkliban@redhat.com over 6 years ago

  • Sprint set to Sprint 34
Actions #5

Updated by daviddavis over 6 years ago

Adding a checklist item to add a pulp-smash issue.

Actions #6

Updated by kersom about 6 years ago

  • Related to Test #4125: Test if creating duplicate content results in 400 added
Actions #7

Updated by kersom about 6 years ago

I added a test case for this issue.

Actions #8

Updated by CodeHeeler about 6 years ago

  • Status changed from ASSIGNED to NEW
  • Assignee deleted (CodeHeeler)
Actions #9

Updated by kersom about 6 years ago

What is the expected behave here?

Actions #10

Updated by daviddavis about 6 years ago

Not a 500 error. Probably a 400.

Actions #11

Updated by amacdona@redhat.com almost 6 years ago

Removed checklist item since there is a related issue

Actions #12

Updated by jortel@redhat.com almost 6 years ago

  • Sprint changed from Sprint 34 to Sprint 46
Actions #13

Updated by daviddavis almost 6 years ago

  • Status changed from NEW to ASSIGNED
  • Assignee set to daviddavis
Actions #14

Updated by daviddavis almost 6 years ago

  • Status changed from ASSIGNED to POST

Added by daviddavis almost 6 years ago

Revision 50dad60c | View on GitHub

Fixing duplicate content exception

fixes #3436 https://pulp.plan.io/issues/3436

Actions #15

Updated by daviddavis almost 6 years ago

  • Status changed from POST to MODIFIED
Actions #16

Updated by kersom almost 6 years ago

If the same artifact is used by with different relative_path no 400 HTTP Error is raised. It that the expected behaviour?

2 different content units using the same artifact and 2 different relative_path.


{'_href': '/pulp/api/v3/content/file/files/16/',
 'artifact': '/pulp/api/v3/artifacts/13/',
 'created': '2018-12-19T18:30:50.562582Z',
 'relative_path': '4d12bb9d-82a5-4f07-ad41-1dfe9e9140da',
 'type': 'file'}

{'_href': '/pulp/api/v3/content/file/files/17/',
 'artifact': '/pulp/api/v3/artifacts/13/',
 'created': '2018-12-19T18:30:50.670502Z',
 'relative_path': '0e512076-e7f7-4502-8d21-83d30fe60aa4',
 'type': 'file'}
Actions #17

Updated by daviddavis almost 6 years ago

If the same artifact is used by with different relative_path no 400 HTTP Error is raised. It that the expected behaviour?

That's correct. Artifacts are unique by relative_path and file. This would be same file with two different names for example.

Actions #18

Updated by bmbouter over 5 years ago

  • Tags deleted (Pulp 3)
Actions #19

Updated by bmbouter almost 5 years ago

  • Sprint/Milestone set to 0.1.0
Actions #20

Updated by bmbouter almost 5 years ago

  • Status changed from MODIFIED to CLOSED - CURRENTRELEASE

Also available in: Atom PDF