Project

Profile

Help

Issue #7329

closed

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

Added by lmjachky over 3 years ago. Updated over 3 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"

Also available in: Atom PDF