Skip to content

Commit

Permalink
Merge pull request #333 from rajulkumar/fix_copy_repo_pairs
Browse files Browse the repository at this point in the history
Fix copy_repo sending incorrect repo pairs when providing multiple pairs
  • Loading branch information
rajulkumar authored Jan 9, 2025
2 parents 4c60ac3 + 6fedeac commit dc12f74
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions src/pubtools/_pulp/tasks/copy_repo.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,14 @@ class RepoCopy(object):
"""The repo to which content was copied."""


class freeze_arguments(partial):
# execute the function only with the args and kwargs that were
# provided while creating the object. args and kwargs provided
# during the call are ignored.
def __call__(self, /, *args, **keywords):
return self.func(*self.args, **self.keywords)


class CopyRepo(CollectorService, PulpClientService, PulpRepositoryOperation):
@property
def content_type_criteria(self):
Expand Down Expand Up @@ -258,16 +266,15 @@ def repo_copy(copy_tasks, repo):
for item in criteria or [None]:
# ensure the criterias are processed and completed/resolved in order
# so that non-rpm copy completes before rpm copy
# pylint:disable=cell-var-from-loop
tasks_f = f_flat_map(
tasks_f,
lambda _: self.pulp_client.copy_content(
freeze_arguments(
self.pulp_client.copy_content,
src_repo,
dest_repo,
criteria=item,
),
)
# pylint:enable=cell-var-from-loop
one_pair_copies.append(tasks_f)
f = f_map(f_sequence(one_pair_copies), partial(repo_copy, repo=dest_repo))
f = f_map(f, self.log_copy)
Expand Down

0 comments on commit dc12f74

Please sign in to comment.