Project

Profile

Help

Issue #7329

closed

When creating a permission using invalid parameters, an internal server error is raised

Added by lmjachky over 4 years ago. Updated over 4 years ago.

Status:
CLOSED - CURRENTRELEASE
Priority:
Normal
Assignee:
Category:
-
Sprint/Milestone:
Start date:
Due date:
Estimated time:
Severity:
2. Medium
Version:
Platform Release:
OS:
Triaged:
Yes
Groomed:
No
Sprint Candidate:
No
Tags:
Sprint:
Sprint 80
Quarter:

Description

(pulp) [vagrant@pulp3-source-fedora31 issue-5087]$ http :24817/pulp/api/v3/groups/
HTTP/1.1 200 OK
Allow: GET, POST, HEAD, OPTIONS
Connection: close
Content-Length: 112
Content-Type: application/json
Date: Tue, 18 Aug 2020 11:55:43 GMT
Server: gunicorn/20.0.4
Vary: Accept, Cookie
X-Frame-Options: SAMEORIGIN
 
{
    "count": 1,
    "next": null,
    "previous": null,
    "results": [
        {
            "id": 1,
            "name": "Gogo2",
            "pulp_href": "/pulp/api/v3/groups/1/"
        }
    ]
}
 
(pulp) [vagrant@pulp3-source-fedora31 issue-5087]$ http :24817/pulp/api/v3/groups/1/model_permissions/
HTTP/1.1 200 OK
Allow: GET, POST, HEAD, OPTIONS
Connection: close
Content-Length: 52
Content-Type: application/json
Date: Tue, 18 Aug 2020 11:55:51 GMT
Server: gunicorn/20.0.4
Vary: Accept, Cookie
X-Frame-Options: SAMEORIGIN
 
{
    "count": 0,
    "next": null,
    "previous": null,
    "results": []
}
 
 
(pulp) [vagrant@pulp3-source-fedora31 issue-5087]$ http :24817/pulp/api/v3/groups/1/model_permissions/ auth_auth_groups_permission_href=/pulp/api/v3/groups/1/
HTTP/1.1 500 Internal Server Error
Connection: close
Content-Length: 27
Content-Type: text/html
Date: Tue, 18 Aug 2020 11:57:20 GMT
Server: gunicorn/20.0.4
Vary: Cookie
X-Frame-Options: SAMEORIGIN
 
<h1>Server Error (500)</h1>
 
(pulp) [vagrant@pulp3-source-fedora31 issue-5087]$ journalctl -u pulpcore-api.service | tail -40
Aug 18 11:57:20 pulp3-source-fedora31.localhost.example.com gunicorn[38083]:   File "/usr/local/lib/pulp/lib64/python3.7/site-packages/django/core/handlers/base.py", line 115, in _get_response
Aug 18 11:57:20 pulp3-source-fedora31.localhost.example.com gunicorn[38083]:     response = self.process_exception_by_middleware(e, request)
Aug 18 11:57:20 pulp3-source-fedora31.localhost.example.com gunicorn[38083]:   File "/usr/local/lib/pulp/lib64/python3.7/site-packages/django/core/handlers/base.py", line 113, in _get_response
Aug 18 11:57:20 pulp3-source-fedora31.localhost.example.com gunicorn[38083]:     response = wrapped_callback(request, *callback_args, **callback_kwargs)
Aug 18 11:57:20 pulp3-source-fedora31.localhost.example.com gunicorn[38083]:   File "/usr/local/lib/pulp/lib64/python3.7/site-packages/django/views/decorators/csrf.py", line 54, in wrapped_view
Aug 18 11:57:20 pulp3-source-fedora31.localhost.example.com gunicorn[38083]:     return view_func(*args, **kwargs)
Aug 18 11:57:20 pulp3-source-fedora31.localhost.example.com gunicorn[38083]:   File "/usr/local/lib/pulp/lib64/python3.7/site-packages/rest_framework/viewsets.py", line 114, in view
Aug 18 11:57:20 pulp3-source-fedora31.localhost.example.com gunicorn[38083]:     return self.dispatch(request, *args, **kwargs)
Aug 18 11:57:20 pulp3-source-fedora31.localhost.example.com gunicorn[38083]:   File "/usr/local/lib/pulp/lib64/python3.7/site-packages/rest_framework/views.py", line 505, in dispatch
Aug 18 11:57:20 pulp3-source-fedora31.localhost.example.com gunicorn[38083]:     response = self.handle_exception(exc)
Aug 18 11:57:20 pulp3-source-fedora31.localhost.example.com gunicorn[38083]:   File "/usr/local/lib/pulp/lib64/python3.7/site-packages/rest_framework/views.py", line 465, in handle_exception
Aug 18 11:57:20 pulp3-source-fedora31.localhost.example.com gunicorn[38083]:     self.raise_uncaught_exception(exc)
Aug 18 11:57:20 pulp3-source-fedora31.localhost.example.com gunicorn[38083]:   File "/usr/local/lib/pulp/lib64/python3.7/site-packages/rest_framework/views.py", line 476, in raise_uncaught_exception
Aug 18 11:57:20 pulp3-source-fedora31.localhost.example.com gunicorn[38083]:     raise exc
Aug 18 11:57:20 pulp3-source-fedora31.localhost.example.com gunicorn[38083]:   File "/usr/local/lib/pulp/lib64/python3.7/site-packages/rest_framework/views.py", line 502, in dispatch
Aug 18 11:57:20 pulp3-source-fedora31.localhost.example.com gunicorn[38083]:     response = handler(request, *args, **kwargs)
Aug 18 11:57:20 pulp3-source-fedora31.localhost.example.com gunicorn[38083]:   File "/home/vagrant/devel/pulpcore/pulpcore/app/viewsets/user.py", line 133, in create
Aug 18 11:57:20 pulp3-source-fedora31.localhost.example.com gunicorn[38083]:     permission = self.get_model_permission(request)
Aug 18 11:57:20 pulp3-source-fedora31.localhost.example.com gunicorn[38083]:   File "/home/vagrant/devel/pulpcore/pulpcore/app/viewsets/user.py", line 101, in get_model_permission
Aug 18 11:57:20 pulp3-source-fedora31.localhost.example.com gunicorn[38083]:     return get_object_or_404(Permission, **data)
Aug 18 11:57:20 pulp3-source-fedora31.localhost.example.com gunicorn[38083]:   File "/usr/local/lib/pulp/lib64/python3.7/site-packages/django/shortcuts.py", line 93, in get_object_or_404
Aug 18 11:57:20 pulp3-source-fedora31.localhost.example.com gunicorn[38083]:     return queryset.get(*args, **kwargs)
Aug 18 11:57:20 pulp3-source-fedora31.localhost.example.com gunicorn[38083]:   File "/usr/local/lib/pulp/lib64/python3.7/site-packages/django/db/models/query.py", line 399, in get
Aug 18 11:57:20 pulp3-source-fedora31.localhost.example.com gunicorn[38083]:     clone = self.filter(*args, **kwargs)
Aug 18 11:57:20 pulp3-source-fedora31.localhost.example.com gunicorn[38083]:   File "/usr/local/lib/pulp/lib64/python3.7/site-packages/django/db/models/query.py", line 892, in filter
Aug 18 11:57:20 pulp3-source-fedora31.localhost.example.com gunicorn[38083]:     return self._filter_or_exclude(False, *args, **kwargs)
Aug 18 11:57:20 pulp3-source-fedora31.localhost.example.com gunicorn[38083]:   File "/usr/local/lib/pulp/lib64/python3.7/site-packages/django/db/models/query.py", line 910, in _filter_or_exclude
Aug 18 11:57:20 pulp3-source-fedora31.localhost.example.com gunicorn[38083]:     clone.query.add_q(Q(*args, **kwargs))
Aug 18 11:57:20 pulp3-source-fedora31.localhost.example.com gunicorn[38083]:   File "/usr/local/lib/pulp/lib64/python3.7/site-packages/django/db/models/sql/query.py", line 1290, in add_q
Aug 18 11:57:20 pulp3-source-fedora31.localhost.example.com gunicorn[38083]:     clause, _ = self._add_q(q_object, self.used_aliases)
Aug 18 11:57:20 pulp3-source-fedora31.localhost.example.com gunicorn[38083]:   File "/usr/local/lib/pulp/lib64/python3.7/site-packages/django/db/models/sql/query.py", line 1318, in _add_q
Aug 18 11:57:20 pulp3-source-fedora31.localhost.example.com gunicorn[38083]:     split_subq=split_subq, simple_col=simple_col,
Aug 18 11:57:20 pulp3-source-fedora31.localhost.example.com gunicorn[38083]:   File "/usr/local/lib/pulp/lib64/python3.7/site-packages/django/db/models/sql/query.py", line 1190, in build_filter
Aug 18 11:57:20 pulp3-source-fedora31.localhost.example.com gunicorn[38083]:     lookups, parts, reffed_expression = self.solve_lookup_type(arg)
Aug 18 11:57:20 pulp3-source-fedora31.localhost.example.com gunicorn[38083]:   File "/usr/local/lib/pulp/lib64/python3.7/site-packages/django/db/models/sql/query.py", line 1049, in solve_lookup_type
Aug 18 11:57:20 pulp3-source-fedora31.localhost.example.com gunicorn[38083]:     _, field, _, lookup_parts = self.names_to_path(lookup_splitted, self.get_meta())
Aug 18 11:57:20 pulp3-source-fedora31.localhost.example.com gunicorn[38083]:   File "/usr/local/lib/pulp/lib64/python3.7/site-packages/django/db/models/sql/query.py", line 1420, in names_to_path
Aug 18 11:57:20 pulp3-source-fedora31.localhost.example.com gunicorn[38083]:     "Choices are: %s" % (name, ", ".join(available)))
Aug 18 11:57:20 pulp3-source-fedora31.localhost.example.com gunicorn[38083]: django.core.exceptions.FieldError: Cannot resolve keyword 'auth_auth_groups_permission_href' into field. Choices are: codename, content_type, content_type_id, group, groupobjectpermission, id, name, user, userobjectpermission
Aug 18 11:57:20 pulp3-source-fedora31.localhost.example.com gunicorn[38083]: 127.0.0.1 - admin [18/Aug/2020:11:57:20 +0000] "POST /pulp/api/v3/groups/1/model_permissions/ HTTP/1.1" 500 27 "-" "HTTPie/2.2.0"

A similar error is raised even when executing a POST request without specifying any parameters:

http  POST :24817/pulp/api/v3/groups/1/model_permissions/

HTTP/1.1 500 Internal Server Error
Connection: close
Content-Length: 27
Content-Type: text/html
Date: Tue, 18 Aug 2020 12:08:19 GMT
Server: gunicorn/20.0.4
Vary: Cookie
X-Frame-Options: SAMEORIGIN

<h1>Server Error (500)</h1>

(pulp) [vagrant@pulp3-source-fedora31 issue-5087]$ journalctl -u pulpcore-api.service | tail -20
Aug 18 12:08:19 pulp3-source-fedora31.localhost.example.com gunicorn[38083]:   File "/usr/local/lib/pulp/lib64/python3.7/site-packages/rest_framework/viewsets.py", line 114, in view
Aug 18 12:08:19 pulp3-source-fedora31.localhost.example.com gunicorn[38083]:     return self.dispatch(request, *args, **kwargs)
Aug 18 12:08:19 pulp3-source-fedora31.localhost.example.com gunicorn[38083]:   File "/usr/local/lib/pulp/lib64/python3.7/site-packages/rest_framework/views.py", line 505, in dispatch
Aug 18 12:08:19 pulp3-source-fedora31.localhost.example.com gunicorn[38083]:     response = self.handle_exception(exc)
Aug 18 12:08:19 pulp3-source-fedora31.localhost.example.com gunicorn[38083]:   File "/usr/local/lib/pulp/lib64/python3.7/site-packages/rest_framework/views.py", line 465, in handle_exception
Aug 18 12:08:19 pulp3-source-fedora31.localhost.example.com gunicorn[38083]:     self.raise_uncaught_exception(exc)
Aug 18 12:08:19 pulp3-source-fedora31.localhost.example.com gunicorn[38083]:   File "/usr/local/lib/pulp/lib64/python3.7/site-packages/rest_framework/views.py", line 476, in raise_uncaught_exception
Aug 18 12:08:19 pulp3-source-fedora31.localhost.example.com gunicorn[38083]:     raise exc
Aug 18 12:08:19 pulp3-source-fedora31.localhost.example.com gunicorn[38083]:   File "/usr/local/lib/pulp/lib64/python3.7/site-packages/rest_framework/views.py", line 502, in dispatch
Aug 18 12:08:19 pulp3-source-fedora31.localhost.example.com gunicorn[38083]:     response = handler(request, *args, **kwargs)
Aug 18 12:08:19 pulp3-source-fedora31.localhost.example.com gunicorn[38083]:   File "/home/vagrant/devel/pulpcore/pulpcore/app/viewsets/user.py", line 133, in create
Aug 18 12:08:19 pulp3-source-fedora31.localhost.example.com gunicorn[38083]:     permission = self.get_model_permission(request)
Aug 18 12:08:19 pulp3-source-fedora31.localhost.example.com gunicorn[38083]:   File "/home/vagrant/devel/pulpcore/pulpcore/app/viewsets/user.py", line 101, in get_model_permission
Aug 18 12:08:19 pulp3-source-fedora31.localhost.example.com gunicorn[38083]:     return get_object_or_404(Permission, **data)
Aug 18 12:08:19 pulp3-source-fedora31.localhost.example.com gunicorn[38083]:   File "/usr/local/lib/pulp/lib64/python3.7/site-packages/django/shortcuts.py", line 93, in get_object_or_404
Aug 18 12:08:19 pulp3-source-fedora31.localhost.example.com gunicorn[38083]:     return queryset.get(*args, **kwargs)
Aug 18 12:08:19 pulp3-source-fedora31.localhost.example.com gunicorn[38083]:   File "/usr/local/lib/pulp/lib64/python3.7/site-packages/django/db/models/query.py", line 412, in get
Aug 18 12:08:19 pulp3-source-fedora31.localhost.example.com gunicorn[38083]:     (self.model._meta.object_name, num)
Aug 18 12:08:19 pulp3-source-fedora31.localhost.example.com gunicorn[38083]: django.contrib.auth.models.Permission.MultipleObjectsReturned: get() returned more than one Permission -- it returned 348!
Aug 18 12:08:19 pulp3-source-fedora31.localhost.example.com gunicorn[38083]: 127.0.0.1 - admin [18/Aug/2020:12:08:19 +0000] "POST /pulp/api/v3/groups/1/model_permissions/ HTTP/1.1" 500 27 "-" "HTTPie/2.2.0"
Actions #1

Updated by lmjachky over 4 years ago

  • Subject changed from When creating a permission using an invalid parameters, an internal server error is raised to When creating a permission using invalid parameters, an internal server error is raised
Actions #2

Updated by lmjachky over 4 years ago

  • Description updated (diff)
Actions #3

Updated by fao89 over 4 years ago

  • Triaged changed from No to Yes
  • Sprint set to Sprint 79
Actions #4

Updated by rchan over 4 years ago

  • Sprint changed from Sprint 79 to Sprint 80
Actions #5

Updated by fao89 over 4 years ago

  • Status changed from NEW to ASSIGNED
  • Assignee set to fao89
Actions #6

Updated by pulpbot over 4 years ago

  • Status changed from ASSIGNED to POST

Added by Fabricio Aguiar over 4 years ago

Revision 6862ba8e | View on GitHub

Fixing groups API validation

https://pulp.plan.io/issues/7329 closes #7329

Actions #7

Updated by Anonymous over 4 years ago

  • Status changed from POST to MODIFIED

Added by Fabricio Aguiar over 4 years ago

Revision e666f7cb | View on GitHub

Fixing groups API validation

https://pulp.plan.io/issues/7329 closes #7329

Actions #9

Updated by dkliban@redhat.com over 4 years ago

  • Sprint/Milestone set to 3.6.1
Actions #10

Updated by pulpbot over 4 years ago

  • Status changed from MODIFIED to CLOSED - CURRENTRELEASE

Also available in: Atom PDF