From ebf0933749823625b427288aa08f7790edb5927b Mon Sep 17 00:00:00 2001 From: Ina Panova Date: Mon, 7 Jun 2021 19:22:51 +0200 Subject: [PATCH] Pulp2 content that is missing downloaded flag is treated as downloaded closes #8863 --- CHANGES/8863.bugfix | 1 + pulp_2to3_migration/app/pre_migration.py | 10 ++++++++-- 2 files changed, 9 insertions(+), 2 deletions(-) create mode 100644 CHANGES/8863.bugfix diff --git a/CHANGES/8863.bugfix b/CHANGES/8863.bugfix new file mode 100644 index 00000000..cf2a9f47 --- /dev/null +++ b/CHANGES/8863.bugfix @@ -0,0 +1 @@ +Pulp2 Content that does not have downloaded flag is marked as downloaded. diff --git a/pulp_2to3_migration/app/pre_migration.py b/pulp_2to3_migration/app/pre_migration.py index 1912fe90..95ba4ff8 100644 --- a/pulp_2to3_migration/app/pre_migration.py +++ b/pulp_2to3_migration/app/pre_migration.py @@ -186,7 +186,10 @@ def delete_removed_pulp2_content(content_model): pulp2detail_pb.total -= 1 continue - downloaded = record.downloaded if hasattr(record, 'downloaded') else False + # very old pulp2 content will not have downloaded field set (prior to lazy sync) + downloaded = hasattr(record, 'downloaded') and ( + record.downloaded or record.downloaded is None + ) if set_pulp2_repo: # This content requires to set pulp 2 repo. E.g. for errata, because 1 pulp2 @@ -299,7 +302,10 @@ def delete_removed_pulp2_content(content_model): for relation in content_relations: record = pulp2_content_by_id[relation.pulp2_unit_id] - downloaded = record.downloaded if hasattr(record, 'downloaded') else False + # very old pulp2 content will not have downloaded field set (prior to lazy sync) + downloaded = hasattr(record, 'downloaded') and ( + record.downloaded or record.downloaded is None + ) specific_content_q = Q( pulp2_content_type_id=record._content_type_id, pulp2_id=record.id,