From 5fd84d9be8818310a010c06602e40b12a749800a Mon Sep 17 00:00:00 2001 From: David Davis Date: Tue, 26 Nov 2019 15:41:18 -0500 Subject: [PATCH] Call new functions for checking file path overlaps ref #5559 Required PR: https://github.com/pulp/pulpcore/pull/420 --- CHANGES/5559.feature | 1 + pulp_file/app/models.py | 15 +++++++++++++-- 2 files changed, 14 insertions(+), 2 deletions(-) create mode 100644 CHANGES/5559.feature diff --git a/CHANGES/5559.feature b/CHANGES/5559.feature new file mode 100644 index 000000000..e99045649 --- /dev/null +++ b/CHANGES/5559.feature @@ -0,0 +1 @@ +Call parent finalize_new_version() method to get path overlap checking. diff --git a/pulp_file/app/models.py b/pulp_file/app/models.py index 075774ed3..240698390 100644 --- a/pulp_file/app/models.py +++ b/pulp_file/app/models.py @@ -10,7 +10,8 @@ Remote, Repository, ) -from pulpcore.plugin.repo_version_utils import remove_duplicates +from pulpcore.plugin.repo_version_utils import remove_duplicates, validate_version_paths +from pulpcore.plugin.publication_utils import validate_publication_paths log = getLogger(__name__) @@ -51,7 +52,10 @@ 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 @@ -59,6 +63,7 @@ def finalize_new_version(self, new_version): """ remove_duplicates(new_version) + validate_version_paths(new_version) class FileRemote(Remote): @@ -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): """