Skip to content
Merged
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
4 changes: 3 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

- N/A
### Added
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you move this to [2.5.0] so we can release the changes after PR is merged?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's normally done right at the time of release because you don't know the date of the release otherwise.

- Introduced `Repository.sync` API (and associated `SyncOptions` classes)
for synchronizing Pulp repositories.

## [2.4.0] - 2020-01-13

Expand Down
15 changes: 14 additions & 1 deletion docs/api/model.rst
Original file line number Diff line number Diff line change
Expand Up @@ -21,18 +21,31 @@ Repository
.. autoclass:: pubtools.pulplib.YumRepository()
:members:

.. autoclass:: pubtools.pulplib.YumSyncOptions()
:members:

.. autoclass:: pubtools.pulplib.FileRepository()
:members:

.. autoclass:: pubtools.pulplib.FileSyncOptions()
:members:

.. autoclass:: pubtools.pulplib.ContainerImageRepository()
:members:

.. autoclass:: pubtools.pulplib.ContainerSyncOptions()
:members:

.. autoclass:: pubtools.pulplib.Distributor()
:members:

.. autoclass:: pubtools.pulplib.PublishOptions()
:members:

.. autoclass:: pubtools.pulplib.SyncOptions()
:members:



Units
-----
Expand All @@ -49,7 +62,7 @@ Units
.. autoclass:: pubtools.pulplib.ModulemdUnit()
:members:

.. autoclass:: pubtools.pulplib.ModulemdDefaultUnit()
.. autoclass:: pubtools.pulplib.ModulemdDefaultsUnit()
:members:

Task
Expand Down
2 changes: 2 additions & 0 deletions pubtools/pulplib/_impl/fake/controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,8 @@ def sync_history(self):
of this sync
``sync_config``:
:class:`~pubtools.pulplib.SyncConfig` (of the appropriate subclass) used for this sync

.. versionadded:: 2.5.0
"""
return self.client._sync_history[:]

Expand Down
13 changes: 11 additions & 2 deletions pubtools/pulplib/_impl/model/repository/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,11 @@ class PublishOptions(object):
class SyncOptions(object):
"""Options controlling a repository
:meth:`~pubtools.pulplib.Repository.sync`.

.. seealso:: Subclasses for specific repository
types: :py:class:`~pubtools.pulplib.FileSyncOptions`,
:py:class:`~pubtools.pulplib.YumSyncOptions`,
:py:class:`~pubtools.pulplib.ContainerSyncOptions`
"""

feed = pulp_attrib(type=str)
Expand Down Expand Up @@ -388,8 +393,8 @@ def publish(self, options=PublishOptions()):

return f_proxy(self._client._publish_repository(self, to_publish))

def sync(self, options=SyncOptions(feed="")):
"""Sync repository with feed
def sync(self, options=None):
"""Sync repository with feed.

Args:
options (SyncOptions)
Expand All @@ -406,7 +411,11 @@ def sync(self, options=SyncOptions(feed="")):
Raises:
DetachedException
If this instance is not attached to a Pulp client.

.. versionadded:: 2.5.0
"""
options = options or SyncOptions(feed="")

if not self._client:
raise DetachedException()

Expand Down
2 changes: 1 addition & 1 deletion pubtools/pulplib/_impl/model/repository/container.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
@attr.s(kw_only=True, frozen=True)
class ContainerSyncOptions(SyncOptions):
"""Options controlling a container repository
:meth:`~pubtools.pulplib.ContainerImageRepository.sync`.
:meth:`~pubtools.pulplib.Repository.sync`.
"""

upstream_name = pulp_attrib(default=None, type=str)
Expand Down
2 changes: 1 addition & 1 deletion pubtools/pulplib/_impl/model/repository/file.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
@attr.s(kw_only=True, frozen=True)
class FileSyncOptions(SyncOptions):
"""Options controlling a file repository
:meth:`~pubtools.pulplib.FileRepository.sync`.
:meth:`~pubtools.pulplib.Repository.sync`.
"""

remove_missing = pulp_attrib(default=False, type=bool)
Expand Down
4 changes: 2 additions & 2 deletions pubtools/pulplib/_impl/model/repository/yum.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@

@attr.s(kw_only=True, frozen=True)
class YumSyncOptions(SyncOptions):
"""Options controlling a container repository
:meth:`~pubtools.pulplib.YumRepository.sync`.
"""Options controlling a yum repository
:meth:`~pubtools.pulplib.Repository.sync`.
"""

query_auth_token = pulp_attrib(default=None, type=str)
Expand Down