Skip to content

Commit dc12f74

Browse files
authored
Merge pull request #333 from rajulkumar/fix_copy_repo_pairs
Fix copy_repo sending incorrect repo pairs when providing multiple pairs
2 parents 4c60ac3 + 6fedeac commit dc12f74

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

src/pubtools/_pulp/tasks/copy_repo.py

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,14 @@ class RepoCopy(object):
102102
"""The repo to which content was copied."""
103103

104104

105+
class freeze_arguments(partial):
106+
# execute the function only with the args and kwargs that were
107+
# provided while creating the object. args and kwargs provided
108+
# during the call are ignored.
109+
def __call__(self, /, *args, **keywords):
110+
return self.func(*self.args, **self.keywords)
111+
112+
105113
class CopyRepo(CollectorService, PulpClientService, PulpRepositoryOperation):
106114
@property
107115
def content_type_criteria(self):
@@ -258,16 +266,15 @@ def repo_copy(copy_tasks, repo):
258266
for item in criteria or [None]:
259267
# ensure the criterias are processed and completed/resolved in order
260268
# so that non-rpm copy completes before rpm copy
261-
# pylint:disable=cell-var-from-loop
262269
tasks_f = f_flat_map(
263270
tasks_f,
264-
lambda _: self.pulp_client.copy_content(
271+
freeze_arguments(
272+
self.pulp_client.copy_content,
265273
src_repo,
266274
dest_repo,
267275
criteria=item,
268276
),
269277
)
270-
# pylint:enable=cell-var-from-loop
271278
one_pair_copies.append(tasks_f)
272279
f = f_map(f_sequence(one_pair_copies), partial(repo_copy, repo=dest_repo))
273280
f = f_map(f, self.log_copy)

0 commit comments

Comments
 (0)