Project

Profile

Help

Issue #2919

500 error when creating repo with duplicate name

Added by dkliban@redhat.com over 2 years ago. Updated 6 months ago.

Status:
CLOSED - CURRENTRELEASE
Priority:
Low
Assignee:
-
Category:
-
Sprint/Milestone:
Start date:
Due date:
Severity:
2. Medium
Version:
Platform Release:
Blocks Release:
OS:
Backwards Incompatible:
No
Triaged:
Yes
Groomed:
No
Sprint Candidate:
No
Tags:
Easy Fix
QA Contact:
Complexity:
Smash Test:
Verified:
No
Verification Required:
No
Sprint:

Description

Looks like the serializer is failing to enforce uniqueness constraint during validation. As a result the database enforces it and the user receives a 500 response.

Traceback:
File "/home/vagrant/.virtualenvs/pulp/lib/python3.5/site-packages/django/core/handlers/base.py" in get_response
  132.                     response = wrapped_callback(request, *callback_args, **callback_kwargs)
File "/home/vagrant/.virtualenvs/pulp/lib/python3.5/site-packages/django/views/decorators/csrf.py" in wrapped_view
  58.         return view_func(*args, **kwargs)
File "/home/vagrant/.virtualenvs/pulp/lib/python3.5/site-packages/rest_framework/viewsets.py" in view
  86.             return self.dispatch(request, *args, **kwargs)
File "/home/vagrant/.virtualenvs/pulp/lib/python3.5/site-packages/rest_framework/views.py" in dispatch
  489.             response = self.handle_exception(exc)
File "/home/vagrant/.virtualenvs/pulp/lib/python3.5/site-packages/rest_framework/views.py" in handle_exception
  449.             self.raise_uncaught_exception(exc)
File "/home/vagrant/.virtualenvs/pulp/lib/python3.5/site-packages/rest_framework/views.py" in dispatch
  486.             response = handler(request, *args, **kwargs)
File "/home/vagrant/.virtualenvs/pulp/lib/python3.5/site-packages/rest_framework/mixins.py" in create
  21.         self.perform_create(serializer)
File "/home/vagrant/.virtualenvs/pulp/lib/python3.5/site-packages/rest_framework/mixins.py" in perform_create
  26.         serializer.save()
File "/home/vagrant/.virtualenvs/pulp/lib/python3.5/site-packages/rest_framework/serializers.py" in save
  215.             self.instance = self.create(validated_data)
File "/home/vagrant/devel/pulp/platform/pulpcore/app/serializers/base.py" in create
  112.         instance = super(ModelSerializer, self).create(validated_data)
File "/home/vagrant/.virtualenvs/pulp/lib/python3.5/site-packages/rest_framework/serializers.py" in create
  916.             instance = ModelClass.objects.create(**validated_data)
File "/home/vagrant/.virtualenvs/pulp/lib/python3.5/site-packages/django/db/models/manager.py" in manager_method
  127.                 return getattr(self.get_queryset(), name)(*args, **kwargs)
File "/home/vagrant/.virtualenvs/pulp/lib/python3.5/site-packages/django/db/models/query.py" in create
  348.         obj.save(force_insert=True, using=self.db)
File "/home/vagrant/.virtualenvs/pulp/lib/python3.5/site-packages/django/db/models/base.py" in save
  734.                        force_update=force_update, update_fields=update_fields)
File "/home/vagrant/.virtualenvs/pulp/lib/python3.5/site-packages/django/db/models/base.py" in save_base
  762.             updated = self._save_table(raw, cls, force_insert, force_update, using, update_fields)
File "/home/vagrant/.virtualenvs/pulp/lib/python3.5/site-packages/django/db/models/base.py" in _save_table
  846.             result = self._do_insert(cls._base_manager, using, fields, update_pk, raw)
File "/home/vagrant/.virtualenvs/pulp/lib/python3.5/site-packages/django/db/models/base.py" in _do_insert
  885.                                using=using, raw=raw)
File "/home/vagrant/.virtualenvs/pulp/lib/python3.5/site-packages/django/db/models/manager.py" in manager_method
  127.                 return getattr(self.get_queryset(), name)(*args, **kwargs)
File "/home/vagrant/.virtualenvs/pulp/lib/python3.5/site-packages/django/db/models/query.py" in _insert
  920.         return query.get_compiler(using=using).execute_sql(return_id)
File "/home/vagrant/.virtualenvs/pulp/lib/python3.5/site-packages/django/db/models/sql/compiler.py" in execute_sql
  974.                 cursor.execute(sql, params)
File "/home/vagrant/.virtualenvs/pulp/lib/python3.5/site-packages/django/db/backends/utils.py" in execute
  79.             return super(CursorDebugWrapper, self).execute(sql, params)
File "/home/vagrant/.virtualenvs/pulp/lib/python3.5/site-packages/django/db/backends/utils.py" in execute
  64.                 return self.cursor.execute(sql, params)
File "/home/vagrant/.virtualenvs/pulp/lib/python3.5/site-packages/django/db/utils.py" in __exit__
  98.                 six.reraise(dj_exc_type, dj_exc_value, traceback)
File "/home/vagrant/.virtualenvs/pulp/lib/python3.5/site-packages/django/utils/six.py" in reraise
  685.             raise value.with_traceback(tb)
File "/home/vagrant/.virtualenvs/pulp/lib/python3.5/site-packages/django/db/backends/utils.py" in execute
  64.                 return self.cursor.execute(sql, params)

Exception Type: IntegrityError at /api/v3/repositories/
Exception Value: duplicate key value violates unique constraint "pulp_app_repository_name_key" 
DETAIL:  Key (name)=(test-repo) already exists.

History

#1 Updated by ttereshc over 2 years ago

  • Priority changed from Normal to Low
  • Triaged changed from No to Yes
  • Tags Easy Fix added

#2 Updated by dalley over 1 year ago

  • Status changed from NEW to CLOSED - CURRENTRELEASE

No longer applicable. Creating a duplicate repository currently yields 400 Bad Request.

#3 Updated by daviddavis 6 months ago

  • Sprint/Milestone set to 3.0

#4 Updated by bmbouter 6 months ago

  • Tags deleted (Pulp 3)

Please register to edit this issue

Also available in: Atom PDF