Project

Profile

Help

Issue #8048

closed

Object permissions endpoint breaks for objects with unknown viewsets

Added by newswangerd almost 4 years ago. Updated over 3 years ago.

Status:
CLOSED - WONTFIX
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 93
Quarter:

Description

When I visit http://localhost:5001/pulp/api/v3/groups/1/object_permissions/ I get the error bellow.

It appears as though the object_permissions/ viewset is trying to look up a ViewSet name on the galaxy_ng Namepsace model, which doesn't exist. I think this is happening because we don't link models and viewsets together in the galaxy_ng plugin. Is there a way to make this work when a viewset can't be determined for a model?

Environment:


Request Method: GET
Request URL: http://localhost:5001/pulp/api/v3/groups/1/object_permissions/

Django Version: 2.2.16
Python Version: 3.6.8
Installed Applications:
<BoxList: ['django.contrib.admin', 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.messages', 'django.contrib.staticfiles', 'import_export', 'django_filters', 'drf_spectacular', 'guardian', 'rest_framework', 'pulpcore.app', 'django_cleanup.apps.CleanupConfig', 'pulp_container.app.PulpContainerPluginAppConfig', 'pulp_ansible.app.PulpAnsiblePluginAppConfig', 'galaxy_ng.app.PulpGalaxyPluginAppConfig', 'rest_framework.authtoken']>
Installed Middleware:
<BoxList: ['django_prometheus.middleware.PrometheusBeforeMiddleware', 'django.middleware.security.SecurityMiddleware', 'whitenoise.middleware.WhiteNoiseMiddleware', 'django.contrib.sessions.middleware.SessionMiddleware', 'django.middleware.common.CommonMiddleware', 'django.middleware.csrf.CsrfViewMiddleware', 'django.contrib.auth.middleware.AuthenticationMiddleware', 'django.contrib.messages.middleware.MessageMiddleware', 'django.middleware.clickjacking.XFrameOptionsMiddleware', 'django_prometheus.middleware.PrometheusAfterMiddleware', 'django_currentuser.middleware.ThreadLocalUserMiddleware']>



Traceback:

File "/venv/lib64/python3.6/site-packages/django/core/handlers/exception.py" in inner
  34.             response = get_response(request)

File "/venv/lib64/python3.6/site-packages/django/core/handlers/base.py" in _get_response
  115.                 response = self.process_exception_by_middleware(e, request)

File "/venv/lib64/python3.6/site-packages/django/core/handlers/base.py" in _get_response
  113.                 response = wrapped_callback(request, *callback_args, **callback_kwargs)

File "/venv/lib64/python3.6/site-packages/django/views/decorators/csrf.py" in wrapped_view
  54.         return view_func(*args, **kwargs)

File "/venv/lib64/python3.6/site-packages/rest_framework/viewsets.py" in view
  114.             return self.dispatch(request, *args, **kwargs)

File "/venv/lib64/python3.6/site-packages/rest_framework/views.py" in dispatch
  505.             response = self.handle_exception(exc)

File "/venv/lib64/python3.6/site-packages/rest_framework/views.py" in handle_exception
  465.             self.raise_uncaught_exception(exc)

File "/venv/lib64/python3.6/site-packages/rest_framework/views.py" in raise_uncaught_exception
  476.         raise exc

File "/venv/lib64/python3.6/site-packages/rest_framework/views.py" in dispatch
  502.             response = handler(request, *args, **kwargs)

File "/venv/lib64/python3.6/site-packages/pulpcore/app/viewsets/user.py" in list
  224.             return self.get_paginated_response(serializer.data)

File "/venv/lib64/python3.6/site-packages/rest_framework/serializers.py" in data
  760.         ret = super().data

File "/venv/lib64/python3.6/site-packages/rest_framework/serializers.py" in data
  260.                 self._data = self.to_representation(self.instance)

File "/venv/lib64/python3.6/site-packages/rest_framework/serializers.py" in to_representation
  678.             self.child.to_representation(item) for item in iterable

File "/venv/lib64/python3.6/site-packages/rest_framework/serializers.py" in <listcomp>
  678.             self.child.to_representation(item) for item in iterable

File "/venv/lib64/python3.6/site-packages/pulpcore/app/serializers/user.py" in to_representation
  55.         representation = super().to_representation(obj)

File "/venv/lib64/python3.6/site-packages/rest_framework/serializers.py" in to_representation
  529.                 ret[field.field_name] = field.to_representation(attribute)

File "/venv/lib64/python3.6/site-packages/pulpcore/app/serializers/user.py" in to_representation
  27.             viewset = get_viewset_for_model(obj.content_object)

File "/venv/lib64/python3.6/site-packages/pulpcore/app/util.py" in get_viewset_for_model
  42.         raise LookupError("Could not determine ViewSet base name for model {}".format(model_class))

Exception Type: LookupError at /pulp/api/v3/groups/1/object_permissions/
Exception Value: Could not determine ViewSet base name for model <class 'galaxy_ng.app.models.namespace.Namespace'>

Also available in: Atom PDF