Skip to content

Commit

Permalink
Call new functions for checking file path overlaps
Browse files Browse the repository at this point in the history
ref #5559

Required PR: pulp/pulpcore#420
  • Loading branch information
David Davis committed Dec 2, 2019
1 parent 15adf70 commit dc7d79c
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGES/5559.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Add checking for path overlapping for RepositoryVersions and Publications.
15 changes: 13 additions & 2 deletions pulp_file/app/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@
Remote,
Repository,
)
from pulpcore.plugin.repo_version_utils import remove_duplicates
from pulpcore.plugin.publication_utils import validate_publication_paths
from pulpcore.plugin.repo_version_utils import remove_duplicates, validate_version_paths


log = getLogger(__name__)
Expand Down Expand Up @@ -51,14 +52,18 @@ class Meta:

def finalize_new_version(self, new_version):
"""
Ensure no added content contains the same `relative_path` as other content.
Finalize and validate the new repository version.
Ensure no added content contains the same `relative_path` as other content and relative
paths don't overlap.
Args:
new_version (pulpcore.app.models.RepositoryVersion): The incomplete RepositoryVersion to
finalize.
"""
remove_duplicates(new_version)
validate_version_paths(new_version)


class FileRemote(Remote):
Expand All @@ -82,6 +87,12 @@ class FilePublication(Publication):
class Meta:
default_related_name = "%(app_label)s_%(model_name)s"

def finalize_new_publication(self):
"""
Validate that artifact paths don't overlap.
"""
validate_publication_paths(self)


class FileDistribution(PublicationDistribution):
"""
Expand Down

0 comments on commit dc7d79c

Please sign in to comment.