Skip to content

Commit

Permalink
Add one more case for touch()
Browse files Browse the repository at this point in the history
closes #9134
  • Loading branch information
ipanova committed Jul 30, 2021
1 parent e9bbfec commit cb1ed52
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 7 deletions.
1 change: 0 additions & 1 deletion pulp_container/app/tasks/builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,6 @@ def add_image_from_directory_to_repository(path, repository, tag):
).save()
tag = Tag(name=tag, tagged_manifest=manifest)
tag.save()
ContentArtifact(artifact=manifest_artifact, content=tag, relative_path=tag.name).save()
with repository.new_version() as new_repo_version:
new_repo_version.add_content(Manifest.objects.filter(pk=manifest.pk))
new_repo_version.add_content(Tag.objects.filter(pk=tag.pk))
Expand Down
9 changes: 3 additions & 6 deletions pulp_container/app/tasks/tag.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from pulpcore.plugin.models import ContentArtifact, CreatedResource, Repository
from pulpcore.plugin.models import CreatedResource, Repository
from pulp_container.app.models import Manifest, Tag


Expand All @@ -13,7 +13,6 @@ def tag_image(manifest_pk, tag, repository_pk):
digest passed with POST request.
"""
manifest = Manifest.objects.get(pk=manifest_pk)
artifact = manifest._artifacts.all()[0]

repository = Repository.objects.get(pk=repository_pk).cast()
latest_version = repository.latest_version()
Expand All @@ -27,10 +26,8 @@ def tag_image(manifest_pk, tag, repository_pk):
if created:
resource = CreatedResource(content_object=manifest_tag)
resource.save()

ContentArtifact.objects.get_or_create(
artifact=artifact, content=manifest_tag, relative_path=tag
)
else:
manifest_tag.touch()

tags_to_add = Tag.objects.filter(pk=manifest_tag.pk).exclude(
pk__in=latest_version.content.all()
Expand Down

0 comments on commit cb1ed52

Please sign in to comment.