Story #5028
closedRepositoryVersion.create() can't be called outside of a task
100%
Description
Docker push requires creating a repository version without dispatching a task. This is currently impossible because the RepositoryVersion.create() method always creates a CreatedResource[0]. A CreatedResource requires a task_id to be saved to the database.
Solution¶
Have the RepositoryVersion.create() check if it's running inside a task. You can do that with Task.current [1].
[0]: https://github.com/pulp/pulpcore/blob/06c7412525c0196169690125eecd63fad3548752/pulpcore/app/models/repository.py#L435
[1]: https://github.com/pulp/pulpcore/blob/8c3798cee5935c6c01af0cf83bdea2359926bfad/pulpcore/app/models/task.py#L339-L350
Updated by dkliban@redhat.com over 5 years ago
- Tracker changed from Issue to Story
- % Done set to 0
Updated by dkliban@redhat.com over 5 years ago
This was filed as part of the docker push workflow work. A possible alternative solution to the problem has been discussed on IRC. This solution would allow plugin writers to create content sets that are not repository versions. Plugin writers would then be able to dispatch a task to either create a repository version from that whole set or to add that content to an existing repository version.
Updated by dkliban@redhat.com over 5 years ago
We should implement this as written in the description. The Docker API is synchronous. It needs to be able to create repository versions synchronously.
Updated by bmbouter over 5 years ago
I don't think the plugin writer benefits from another parameter to allow this to run outside of a task or not. The plugin writer is creating it, and we should allow them to have it wherever they want.
Updated by daviddavis about 5 years ago
- Groomed changed from No to Yes
- Sprint set to Sprint 60
Added by Fabricio Aguiar about 5 years ago
Updated by fao89 about 5 years ago
- Status changed from NEW to POST
- Assignee set to fao89
Updated by Anonymous about 5 years ago
- Status changed from POST to MODIFIED
- % Done changed from 0 to 100
Applied in changeset pulpcore|111bf4cd625b1b9ddfe1b586595261ae441ac865.
Updated by bmbouter almost 5 years ago
- Status changed from MODIFIED to CLOSED - CURRENTRELEASE
Repository version creation w/o CreatedResource
Allowing to create a repository version without dispatching a task. closes #5028 https://pulp.plan.io/issues/5028