diff --git a/pubtools/pulplib/_impl/client/client.py b/pubtools/pulplib/_impl/client/client.py index 65c52558..bde72bdc 100644 --- a/pubtools/pulplib/_impl/client/client.py +++ b/pubtools/pulplib/_impl/client/client.py @@ -316,6 +316,38 @@ def set_maintenance(self, report): return f_flat_map(upload_ft, lambda _: repo.publish()) + def copy_repo_content( + self, origin_repo, dest_repo, criteria=None, override_config=None + ): + """ + Args: + origin_repo: + String of the origin repo name + dest_repo: + String of the destination repo name + criteria: + optional Criteria object with filter parameters + override_config: + optional dictionary to override configuration options + Return: + Future[list[:class:`~pubtools.pulplib.Task`]] + A future which is resolved when the packages have been copied + to the destination repo + """ + url = os.path.join( + self._url, "pulp/api/v2/repositories/%s/actions/associate/" % dest_repo + ) + + data = {"source_repo_id": origin_repo} + if criteria: + data["criteria"] = criteria + if override_config: + data["override_config"] = override_config + + return self._task_executor.submit( + self._do_request, method="POST", url=url, json=data + ) + def get_content_type_ids(self): """Get the content types supported by this Pulp server. diff --git a/setup.py b/setup.py index 5feb4896..b2fde7fd 100644 --- a/setup.py +++ b/setup.py @@ -21,7 +21,7 @@ def get_requirements(): setup( name="pubtools-pulplib", - version="2.4.0", + version="2.5.0", packages=find_packages(exclude=["tests"]), package_data={"pubtools.pulplib._impl.schema": ["*.yaml"]}, url="https://github.com/release-engineering/pubtools-pulplib",