Project

Profile

Help

Issue #3436

Creating duplicate content results in 500 IntegrityError

Added by daviddavis over 2 years ago. Updated 7 months 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 - COMPLETE<a title="Actions" class="icon-only icon-actions js-contextmenu" href="#">Actions</a>

Associated revisions

History

#1 Updated by dalley over 2 years ago

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

#2 Updated by dkliban@redhat.com over 2 years ago

  • Sprint Candidate changed from No to Yes

#3 Updated by CodeHeeler over 2 years ago

  • Status changed from NEW to ASSIGNED
  • Assignee set to CodeHeeler

#4 Updated by dkliban@redhat.com over 2 years ago

  • Sprint set to Sprint 34

#5 Updated by daviddavis over 2 years ago

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

#6 Updated by kersom almost 2 years ago

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

#7 Updated by kersom almost 2 years ago

I added a test case for this issue.

#8 Updated by CodeHeeler almost 2 years ago

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

#9 Updated by kersom almost 2 years ago

What is the expected behave here?

#10 Updated by daviddavis almost 2 years ago

Not a 500 error. Probably a 400.

#11 Updated by amacdona@redhat.com almost 2 years ago

  • Checklist item deleted (Consider adding a pulp-smash issue)

Removed checklist item since there is a related issue

#12 Updated by jortel@redhat.com almost 2 years ago

  • Sprint changed from Sprint 34 to Sprint 46

#13 Updated by daviddavis almost 2 years ago

  • Status changed from NEW to ASSIGNED
  • Assignee set to daviddavis

#14 Updated by daviddavis almost 2 years ago

  • Status changed from ASSIGNED to POST

#15 Updated by daviddavis almost 2 years ago

  • Status changed from POST to MODIFIED

#16 Updated by kersom almost 2 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'}

#17 Updated by daviddavis almost 2 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.

#18 Updated by bmbouter over 1 year ago

  • Tags deleted (Pulp 3)

#19 Updated by bmbouter 11 months ago

  • Sprint/Milestone set to 0.1.0

#20 Updated by bmbouter 11 months ago

  • Status changed from MODIFIED to CLOSED - CURRENTRELEASE

Please register to edit this issue

Also available in: Atom PDF