Issue #5125
closedNew release 3.10 of DRF has breaking changes
Added by daviddavis about 5 years ago. Updated over 4 years ago.
Description
The first one I saw is that detail_route was removed.
Updated by amacdona@redhat.com about 5 years ago
- Status changed from NEW to ASSIGNED
- Assignee set to amacdona@redhat.com
- Sprint set to Sprint 56
At a minimum, there is an import error that prevents pulplift from completing.
Updated by amacdona@redhat.com about 5 years ago
I've substituted `action` with `detail=True`, to fix the first problem, which shows another:
TASK [pulp-database : Create database migrations for plugins] ******************
failed: [pulp3-source-fedora28] (item=pulp-file) => {
"ansible_loop_var": "item",
"changed": true,
"cmd": [
"/usr/local/lib/pulp/bin/django-admin",
"makemigrations",
"file"
],
"delta": "0:00:01.576581",
"end": "2019-07-15 16:34:51.490480",
"item": "pulp-file",
"rc": 1,
"start": "2019-07-15 16:34:49.913899"
}
STDERR:
Traceback (most recent call last):
File "/usr/local/lib/pulp/lib64/python3.6/site-packages/rest_framework/settings.py", line 177, in import_from_string
return import_string(val)
File "/usr/local/lib/pulp/lib64/python3.6/site-packages/django/utils/module_loading.py", line 17, in import_string
module = import_module(module_path)
File "/usr/lib64/python3.6/importlib/__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 994, in _gcd_import
File "<frozen importlib._bootstrap>", line 971, in _find_and_load
File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 665, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 678, in exec_module
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "/home/vagrant/devel/pulpcore/pulpcore/app/openapigenerator.py", line 6, in <module>
from drf_yasg.generators import OpenAPISchemaGenerator
File "/usr/local/lib/pulp/lib64/python3.6/site-packages/drf_yasg/generators.py", line 11, in <module>
from rest_framework.schemas.generators import SchemaGenerator, endpoint_ordering, get_pk_name
ImportError: cannot import name 'SchemaGenerator'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/local/lib/pulp/bin/django-admin", line 11, in <module>
sys.exit(execute_from_command_line())
File "/usr/local/lib/pulp/lib64/python3.6/site-packages/django/core/management/__init__.py", line 381, in execute_from_command_line
utility.execute()
File "/usr/local/lib/pulp/lib64/python3.6/site-packages/django/core/management/__init__.py", line 375, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/usr/local/lib/pulp/lib64/python3.6/site-packages/django/core/management/base.py", line 323, in run_from_argv
self.execute(*args, **cmd_options)
File "/usr/local/lib/pulp/lib64/python3.6/site-packages/django/core/management/base.py", line 361, in execute
self.check()
File "/usr/local/lib/pulp/lib64/python3.6/site-packages/django/core/management/base.py", line 390, in check
include_deployment_checks=include_deployment_checks,
File "/usr/local/lib/pulp/lib64/python3.6/site-packages/django/core/management/base.py", line 377, in _run_checks
return checks.run_checks(**kwargs)
File "/usr/local/lib/pulp/lib64/python3.6/site-packages/django/core/checks/registry.py", line 72, in run_checks
new_errors = check(app_configs=app_configs)
File "/usr/local/lib/pulp/lib64/python3.6/site-packages/django/core/checks/urls.py", line 40, in check_url_namespaces_unique
all_namespaces = _load_all_namespaces(resolver)
File "/usr/local/lib/pulp/lib64/python3.6/site-packages/django/core/checks/urls.py", line 57, in _load_all_namespaces
url_patterns = getattr(resolver, 'url_patterns', [])
File "/usr/local/lib/pulp/lib64/python3.6/site-packages/django/utils/functional.py", line 80, in __get__
res = instance.__dict__[self.name] = self.func(instance)
File "/usr/local/lib/pulp/lib64/python3.6/site-packages/django/urls/resolvers.py", line 579, in url_patterns
patterns = getattr(self.urlconf_module, "urlpatterns", self.urlconf_module)
File "/usr/local/lib/pulp/lib64/python3.6/site-packages/django/utils/functional.py", line 80, in __get__
res = instance.__dict__[self.name] = self.func(instance)
File "/usr/local/lib/pulp/lib64/python3.6/site-packages/django/urls/resolvers.py", line 572, in urlconf_module
return import_module(self.urlconf_name)
File "/usr/lib64/python3.6/importlib/__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 994, in _gcd_import
File "<frozen importlib._bootstrap>", line 971, in _find_and_load
File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 665, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 678, in exec_module
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "/home/vagrant/devel/pulpcore/pulpcore/app/urls.py", line 134, in <module>
permission_classes=(permissions.AllowAny,),
File "/usr/local/lib/pulp/lib64/python3.6/site-packages/drf_yasg/views.py", line 68, in get_schema_view
_generator_class = generator_class or swagger_settings.DEFAULT_GENERATOR_CLASS
File "/usr/local/lib/pulp/lib64/python3.6/site-packages/drf_yasg/app_settings.py", line 121, in __getattr__
val = perform_import(val, attr)
File "/usr/local/lib/pulp/lib64/python3.6/site-packages/rest_framework/settings.py", line 166, in perform_import
return import_from_string(val, setting_name)
File "/usr/local/lib/pulp/lib64/python3.6/site-packages/rest_framework/settings.py", line 180, in import_from_string
raise ImportError(msg)
ImportError: Could not import 'pulpcore.app.openapigenerator.PulpOpenAPISchemaGenerator' for API setting 'DEFAULT_GENERATOR_CLASS'. ImportError: cannot import name 'SchemaGenerator'.
MSG:
non-zero return code
Updated by amacdona@redhat.com about 5 years ago
The traceback in note-2 seems to be caused by drf-yasg which has an open issue: https://github.com/axnsan12/drf-yasg/issues/410
Added by amacdona@redhat.com about 5 years ago
Updated by amacdona@redhat.com about 5 years ago
Because of the drf-yasg issue, it will not be possible to fix the problems with 3.10 until e: https://github.com/axnsan12/drf-yasg/issues/410 is merged. I'm going to leave this issue open and return it to NEW.
In the meantime, I've merged https://github.com/pulp/pulpcore/pull/209/ which pins drf to < 3.10. For whoever picks this up, please remove the pin as well.
Updated by amacdona@redhat.com about 5 years ago
- Status changed from ASSIGNED to NEW
- Assignee changed from amacdona@redhat.com to bbuckingham@redhat.com
Updated by daviddavis about 5 years ago
- Assignee deleted (
bbuckingham@redhat.com)
Updated by amacdona@redhat.com about 5 years ago
drf-yasg has been updated, this is now unblocked.
Updated by CodeHeeler about 5 years ago
- Status changed from NEW to ASSIGNED
- Assignee set to CodeHeeler
Updated by CodeHeeler about 5 years ago
- Status changed from ASSIGNED to POST
PRs at this stage:
https://github.com/pulp/pulpcore/pull/213
https://github.com/pulp/pulp_file/pull/263
Currently blocked awaiting drf-yasg 1.16.2 fixing another blocker
Updated by CodeHeeler about 5 years ago
Travis test failing:
https://travis-ci.com/pulp/pulpcore/jobs/219254034
Getting a 500 error when hitting pulp/api/v3/docs/api.json?plugin=pulpcore
Traceback:
-- Logs begin at Wed 2019-07-24 21:03:17 UTC. --
Jul 24 21:24:20 pulp3-source-fedora28.localhost.example.com gunicorn[27696]: File "/home/vagrant/devel/pulpcore/pulpcore/app/openapigenerator.py", line 258, in get_operation
Jul 24 21:24:20 pulp3-source-fedora28.localhost.example.com gunicorn[27696]: if 'file' in [param['type'] for param in self.get_request_body_parameters(multipart)]:
Jul 24 21:24:20 pulp3-source-fedora28.localhost.example.com gunicorn[27696]: File "/usr/local/lib/pulp/lib64/python3.6/site-packages/drf_yasg/inspectors/view.py", line 71, in get_request_body_parameters
Jul 24 21:24:20 pulp3-source-fedora28.localhost.example.com gunicorn[27696]: serializer = self.get_request_serializer()
Jul 24 21:24:20 pulp3-source-fedora28.localhost.example.com gunicorn[27696]: File "/usr/local/lib/pulp/lib64/python3.6/site-packages/drf_yasg/inspectors/view.py", line 118, in get_request_serializer
Jul 24 21:24:20 pulp3-source-fedora28.localhost.example.com gunicorn[27696]: body_override = self._get_request_body_override()
Jul 24 21:24:20 pulp3-source-fedora28.localhost.example.com gunicorn[27696]: File "/usr/local/lib/pulp/lib64/python3.6/site-packages/drf_yasg/inspectors/view.py", line 105, in _get_request_body_override
Jul 24 21:24:20 pulp3-source-fedora28.localhost.example.com gunicorn[27696]: "); are you looking for query_serializer or manual_parameters?")
Jul 24 21:24:20 pulp3-source-fedora28.localhost.example.com gunicorn[27696]: drf_yasg.errors.SwaggerGenerationError: request_body can only be applied to (PUT,PATCH,POST,DELETE); are you looking for query_serializer or manual_parameters?
Jul 24 21:24:20 pulp3-source-fedora28.localhost.example.com gunicorn[27696]: 127.0.0.1 - admin [24/Jul/2019:21:24:20 +0000] "GET /pulp/api/v3/docs/api.json?plugin=pulpcore HTTP/1.1" 500 27 "-" "HTTPie/0.9.4"
Updated by dkliban@redhat.com about 5 years ago
That traceback is saying that Pulp should not call get_request_body_parameters() when generating OpenAPI schema for GET operations. Pulp should check the type of the operation before trying to call get_request_body_parameters() on line 258 of pulpcore/pulpcore/app/openapigenerator.py.
Added by CodeHeeler about 5 years ago
Revision 249323e2 | View on GitHub
Fix breaking changes from DRF 3.10
Django restframework 3.10.0 has introduced breaking changes Unpinning DRF now that a drf-yasg blocker has been fixed
Required PR: https://github.com/pulp/pulp_file/pull/263
Updated by CodeHeeler about 5 years ago
- Status changed from POST to MODIFIED
Applied in changeset pulpcore|249323e24348f2f1f11cf89e76deb70210b23d99.
Added by CodeHeeler about 5 years ago
Revision 383d12a4 | View on GitHub
Fix breaking changes from DRF 3.10
DRF 3.10.0 introduced breaking changes. Namely, @detail_route decorator is replaced by @action(detail=True)
Updated by CodeHeeler about 5 years ago
- Status changed from POST to MODIFIED
Applied in changeset pulp_file:383d12a43552f53d26015d013f516a18507b7022.
Updated by bmbouter over 4 years ago
- Status changed from MODIFIED to CLOSED - CURRENTRELEASE
Pin DRF to < 3.10 due to breaking changes
We cannot fix the incompatibility yet because another dependency, drf-yasg does not support drf 3.10 yet. https://github.com/axnsan12/drf-yasg/issues/410
https://pulp.plan.io/issues/5125 re #5125