Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 33 additions & 0 deletions pubtools/pulplib/_impl/client/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -316,6 +316,39 @@ 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:
prepared_search = search_for_criteria(criteria)
data["criteria"] = { "filters": prepared_search.filters}
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.

Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down