Skip to content

Commit 4212bf1

Browse files
committed
Fixed copy_repo copied all content types when copying only rpms [RHELDST-28235]
copy_repo creates a criteria matching the content_type_id for non-rpm content types. However, in Pulp the type_ids filter with empty type_ids list included all the content types in the result. Hence, the copy-repo copied all the content types when requested only for rpms, as it generated an empty type_ids list for non-rpms. Hence, this adds a check to skip empty type_ids/content_type_id list.
1 parent 35eea0c commit 4212bf1

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

src/pubtools/_pulp/tasks/copy_repo.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -148,11 +148,14 @@ def str_to_content_type(content_type_id):
148148
# criteria for all non-rpm content types
149149
# unit_fields are ignored as they are small in size and the repos have
150150
# small unit counts for non-rpm content types
151-
criteria.append(
152-
Criteria.with_field(
153-
"content_type_id", Matcher.in_(sorted(non_rpm_content_types))
151+
if non_rpm_content_types:
152+
# type_id filter with empty list includes all the content types.
153+
# hence, check for the presence of non-rpm content types.
154+
criteria.append(
155+
Criteria.with_field(
156+
"content_type_id", Matcher.in_(sorted(non_rpm_content_types))
157+
)
154158
)
155-
)
156159

157160
# criteria for rpm content types
158161
# unit_fields to keep a check on memory consumption with large rpm unit

0 commit comments

Comments
 (0)