From b01209a3847737fefd82351966acf0ebdc9f445c Mon Sep 17 00:00:00 2001 From: Gerrod Ubben Date: Tue, 5 Oct 2021 15:37:24 -0400 Subject: [PATCH] Adjust dispatch calls to core>=3.15 interface backports #443 fixes #446 (cherry picked from commit 9e295318bd82f4b5ff767735811243267aa1e5bc) --- CHANGES/446.bugfix | 2 ++ pulp_python/app/pypi/views.py | 4 ++-- pulp_python/app/viewsets.py | 4 ++-- 3 files changed, 6 insertions(+), 4 deletions(-) create mode 100644 CHANGES/446.bugfix diff --git a/CHANGES/446.bugfix b/CHANGES/446.bugfix new file mode 100644 index 000000000..fe471e118 --- /dev/null +++ b/CHANGES/446.bugfix @@ -0,0 +1,2 @@ +Changed the use of ``dispatch`` to match the signature from pulpcore>=3.15. +(backported from #443) diff --git a/pulp_python/app/pypi/views.py b/pulp_python/app/pypi/views.py index f3948520e..c3020b7cc 100644 --- a/pulp_python/app/pypi/views.py +++ b/pulp_python/app/pypi/views.py @@ -127,7 +127,7 @@ def upload(self, request, path): if settings.PYTHON_GROUP_UPLOADS: return self.upload_package_group(repo, artifact, filename, request.session) - result = dispatch(tasks.upload, [artifact, repo], + result = dispatch(tasks.upload, exclusive_resources=[artifact, repo], kwargs={"artifact_sha256": artifact.sha256, "filename": filename, "repository_pk": str(repo.pk)}) @@ -164,7 +164,7 @@ def create_group_upload_task(self, cur_session, repository, artifact, filename, cur_session['artifacts'] = [(str(artifact.sha256), filename)] cur_session.modified = False cur_session.save() - result = dispatch(tasks.upload_group, [artifact, repository], + result = dispatch(tasks.upload_group, exclusive_resources=[artifact, repository], kwargs={"session_pk": str(cur_session.session_key), "repository_pk": str(repository.pk)}) return reverse('tasks-detail', args=[result.pk], request=None) diff --git a/pulp_python/app/viewsets.py b/pulp_python/app/viewsets.py index 8e148392b..88f38121d 100644 --- a/pulp_python/app/viewsets.py +++ b/pulp_python/app/viewsets.py @@ -51,7 +51,7 @@ def sync(self, request, pk): result = dispatch( tasks.sync, - [repository, remote], + exclusive_resources=[repository, remote], kwargs={ 'remote_pk': str(remote.pk), 'repository_pk': str(repository.pk), @@ -214,7 +214,7 @@ def create(self, request): result = dispatch( tasks.publish, - [repository_version.repository], + exclusive_resources=[repository_version.repository], kwargs={ 'repository_version_pk': str(repository_version.pk) }