From 1988dd6eadbbdecafafbab6aa6e1f58909b27943 Mon Sep 17 00:00:00 2001 From: Quirin Pamp Date: Thu, 22 Apr 2021 11:22:07 +0200 Subject: [PATCH] Skip PackageReleaseComponents if Package was skipped fixes #8612 https://pulp.plan.io/issues/8612 (cherry picked from commit 1ad1be59ddfa43d11eb7e9a26c62004ade5f3d6d) --- CHANGES/8612.bugfix | 1 + pulp_2to3_migration/app/plugin/deb/pulp_2to3_models.py | 5 +++++ 2 files changed, 6 insertions(+) create mode 100644 CHANGES/8612.bugfix diff --git a/CHANGES/8612.bugfix b/CHANGES/8612.bugfix new file mode 100644 index 00000000..626d69a0 --- /dev/null +++ b/CHANGES/8612.bugfix @@ -0,0 +1 @@ +Fixed a bug in the deb pipeline that was preventing successfull skipping of corrupted content for migrations with ``skip_corrupted=True``. diff --git a/pulp_2to3_migration/app/plugin/deb/pulp_2to3_models.py b/pulp_2to3_migration/app/plugin/deb/pulp_2to3_models.py index 635d00d7..8d3391e8 100644 --- a/pulp_2to3_migration/app/plugin/deb/pulp_2to3_models.py +++ b/pulp_2to3_migration/app/plugin/deb/pulp_2to3_models.py @@ -449,6 +449,11 @@ def create_pulp3_content(self): relative_path=self.package_relative_path, sha256=self.package_sha256, ).first() + if not package: + # Perhaps the package was never created because the file was corrupt! + # We simply don't create the PackageReleaseComponent (just how the Package + # itself was not created) and hope for the best. + return (None, None) pulp3_package_release_component = pulp3_models.PackageReleaseComponent( release_component=release_component, package=package,