diff --git a/crmsh/prun/prun.py b/crmsh/prun/prun.py index cc153a123..23c6b9106 100644 --- a/crmsh/prun/prun.py +++ b/crmsh/prun/prun.py @@ -218,6 +218,7 @@ def pfetch_from_remote( recursive=False, *, concurrency: int = _DEFAULT_CONCURRENCY, + interceptor: PRunInterceptor = PRunInterceptor(), ) -> typing.Dict[str, typing.Union[str, PRunError]]: """Copy files from remote hosts to local concurrently. @@ -238,7 +239,7 @@ def pfetch_from_remote( tasks = [_build_fetch_task("-S '{}'".format(ssh.name), host, src, dst, flags) for host in hosts] runner = Runner(concurrency) for task in tasks: - runner.add_task(task) + runner.add_task(interceptor.task(task)) runner.run() finally: if ssh is not None: @@ -247,7 +248,7 @@ def pfetch_from_remote( basename = os.path.basename(src) return { host: v if v is not None else f"{dst}/{host}/{basename}" - for host, v in ((task.context['host'], _parse_copy_result(task)) for task in tasks) + for host, v in ((task.context['host'], _parse_copy_result(task, interceptor)) for task in tasks) }