Project

Profile

Help

Story #5028

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

Added by dkliban@redhat.com 4 months ago. Updated about 10 hours ago.

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

0%

Platform Release:
Blocks Release:
Backwards Incompatible:
No
Groomed:
No
Sprint Candidate:
No
Tags:
QA Contact:
Complexity:
Smash Test:
Verified:
No
Verification Required:
No
Sprint:

Description

Docker push requires creating a repository version without dispatching a task. This is currently impossible because the RepositoryVersion.create() method always creates a CreatedResource0. 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

History

#1 Updated by dkliban@redhat.com 4 months ago

  • Tracker changed from Issue to Story
  • % Done set to 0

#2 Updated by dkliban@redhat.com 3 months 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.

#3 Updated by dkliban@redhat.com 2 months 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.

#4 Updated by bmbouter 2 months 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.

#5 Updated by dkliban@redhat.com 16 days ago

  • Sprint/Milestone set to 3.0

#6 Updated by bmbouter about 10 hours ago

  • Description updated (diff)

#7 Updated by bmbouter about 10 hours ago

  • Description updated (diff)

Please register to edit this issue

Also available in: Atom PDF