Actions
Issue #8500
closedAn internal error is raised when assigning permissions to a non-existing object
Start date:
Due date:
Estimated time:
Severity:
2. Medium
Version:
Platform Release:
OS:
Triaged:
Yes
Groomed:
No
Sprint Candidate:
No
Tags:
Sprint:
Sprint 101
Quarter:
Description
Steps to reproduce the behaviour:
(pulp) [vagrant@pulp3-source-fedora32 ~]$ pulp group create --name cli_test_group
{
"name": "cli_test_group",
"pulp_href": "/pulp/api/v3/groups/1/",
"id": 1
}
(pulp) [vagrant@pulp3-source-fedora32 ~]$ pulp group permission add --groupname cli_test_group --permission auth.view_group
(pulp) [vagrant@pulp3-source-fedora32 ~]$ pulp group permission list --groupname cli_test_group
[
{
"pulp_href": "/pulp/api/v3/groups/1/model_permissions/12/",
"id": 12,
"permission": "auth.view_group",
"obj": null
}
]
(pulp) [vagrant@pulp3-source-fedora32 ~]$ pulp group permission -t object add --groupname cli_test_group --permission file.view_filerepository --object /pulp/api/v3/repositories/file/file/44d1a790-27db-4e40-8903-1dead247dd0e/
Error: <h1>Server Error (500)</h1>
Traceback:
Traceback (most recent call last):
File "/usr/local/lib/pulp/lib64/python3.8/site-packages/django/core/handlers/exception.py", line 34, in inner
response = get_response(request)
File "/usr/local/lib/pulp/lib64/python3.8/site-packages/django/core/handlers/base.py", line 115, in _get_response
response = self.process_exception_by_middleware(e, request)
File "/usr/local/lib/pulp/lib64/python3.8/site-packages/django/core/handlers/base.py", line 113, in _get_response
response = wrapped_callback(request, *callback_args, **callback_kwargs)
File "/usr/local/lib/pulp/lib64/python3.8/site-packages/django/views/decorators/csrf.py", line 54, in wrapped_view
return view_func(*args, **kwargs)
File "/usr/local/lib/pulp/lib64/python3.8/site-packages/rest_framework/viewsets.py", line 125, in view
return self.dispatch(request, *args, **kwargs)
File "/usr/local/lib/pulp/lib64/python3.8/site-packages/rest_framework/views.py", line 509, in dispatch
response = self.handle_exception(exc)
File "/usr/local/lib/pulp/lib64/python3.8/site-packages/rest_framework/views.py", line 469, in handle_exception
self.raise_uncaught_exception(exc)
File "/usr/local/lib/pulp/lib64/python3.8/site-packages/rest_framework/views.py", line 480, in raise_uncaught_exception
raise exc
File "/usr/local/lib/pulp/lib64/python3.8/site-packages/rest_framework/views.py", line 506, in dispatch
response = handler(request, *args, **kwargs)
File "/home/vagrant/devel/pulpcore/pulpcore/app/viewsets/user.py", line 333, in create
object_permission.save()
File "/usr/local/lib/pulp/lib64/python3.8/site-packages/guardian/models/models.py", line 29, in save
content_type = get_content_type(self.content_object)
File "/usr/local/lib/pulp/lib64/python3.8/site-packages/guardian/ctypes.py", line 10, in get_content_type
return get_content_type_function(obj)
File "/usr/local/lib/pulp/lib64/python3.8/site-packages/guardian/ctypes.py", line 14, in get_default_content_type
return ContentType.objects.get_for_model(obj)
File "/usr/local/lib/pulp/lib64/python3.8/site-packages/django/contrib/contenttypes/models.py", line 40, in get_for_model
opts = self._get_opts(model, for_concrete_model)
File "/usr/local/lib/pulp/lib64/python3.8/site-packages/django/contrib/contenttypes/models.py", line 27, in _get_opts
model = model._meta.concrete_model
AttributeError: 'NoneType' object has no attribute '_meta'
Actions
Validate objects in GroupObjectPermissionViewSet
closes #8500