Project

Profile

Help

Story #5028

closed

RepositoryVersion.create() can't be called outside of a task

Added by dkliban@redhat.com almost 5 years ago. Updated over 4 years ago.

Status:
CLOSED - CURRENTRELEASE
Priority:
Normal
Assignee:
Category:
-
Sprint/Milestone:
Start date:
Due date:
% Done:

100%

Estimated time:
Platform Release:
Groomed:
Yes
Sprint Candidate:
No
Tags:
Sprint:
Sprint 60
Quarter:

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

Actions #1

Updated by dkliban@redhat.com almost 5 years ago

  • Tracker changed from Issue to Story
  • % Done set to 0
Actions #2

Updated by dkliban@redhat.com almost 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.

Actions #3

Updated by dkliban@redhat.com over 4 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.

Actions #4

Updated by bmbouter over 4 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.

Actions #5

Updated by dkliban@redhat.com over 4 years ago

  • Sprint/Milestone set to 3.0.0
Actions #6

Updated by bmbouter over 4 years ago

  • Description updated (diff)
Actions #7

Updated by bmbouter over 4 years ago

  • Description updated (diff)
Actions #8

Updated by daviddavis over 4 years ago

  • Groomed changed from No to Yes
  • Sprint set to Sprint 60

Added by Fabricio Aguiar over 4 years ago

Revision 111bf4cd | View on GitHub

Repository version creation w/o CreatedResource

Allowing to create a repository version without dispatching a task. closes #5028 https://pulp.plan.io/issues/5028

Actions #9

Updated by fao89 over 4 years ago

  • Status changed from NEW to POST
  • Assignee set to fao89
Actions #10

Updated by Anonymous over 4 years ago

  • Status changed from POST to MODIFIED
  • % Done changed from 0 to 100
Actions #11

Updated by bmbouter over 4 years ago

  • Status changed from MODIFIED to CLOSED - CURRENTRELEASE

Also available in: Atom PDF