Skip to content

Commit

Permalink
Add docker_manifests endpoint to repositories
Browse files Browse the repository at this point in the history
  • Loading branch information
vsedmik committed May 31, 2024
1 parent bb22ffc commit 71e6a96
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
22 changes: 22 additions & 0 deletions nailgun/entities.py
Original file line number Diff line number Diff line change
Expand Up @@ -6878,6 +6878,8 @@ def path(self, which=None):
The format of the returned path depends on the value of ``which``:
docker_manifests
/repositories/<id>/docker_manifests
errata
/repositories/<id>/errata
files
Expand All @@ -6901,6 +6903,7 @@ def path(self, which=None):
"""
if which in (
'docker_manifests',
'errata',
'files',
'packages',
Expand Down Expand Up @@ -6940,6 +6943,25 @@ def create_missing(self):
self._fields['docker_upstream_name'].required = True
super().create_missing()

def docker_manifests(self, synchronous=True, timeout=None, **kwargs):
"""List docker manifests inside repository.
:param synchronous: What should happen if the server returns an HTTP
202 (accepted) status code? Wait for the task to complete if
``True``. Immediately return the server's response otherwise.
:param timeout: Maximum number of seconds to wait until timing out.
Defaults to ``nailgun.entity_mixins.TASK_TIMEOUT``.
:param kwargs: Arguments to pass to requests.
:returns: The server's response, with all JSON decoded.
:raises: ``requests.exceptions.HTTPError`` If the server responds with
an HTTP 4XX or 5XX message.
"""
kwargs = kwargs.copy()
kwargs.update(self._server_config.get_client_kwargs())
response = client.get(self.path('docker_manifests'), **kwargs)
return _handle_response(response, self._server_config, synchronous, timeout)

def errata(self, synchronous=True, timeout=None, **kwargs):
"""List errata inside repository.
Expand Down
2 changes: 2 additions & 0 deletions tests/test_entities.py
Original file line number Diff line number Diff line change
Expand Up @@ -343,6 +343,7 @@ def test_id_and_which(self):
(entities.Organization, 'repo_discover'),
(entities.Product, 'sync'),
(entities.PuppetClass, 'smart_class_parameters'),
(entities.Repository, 'docker_manifests'),
(entities.Repository, 'errata'),
(entities.Repository, 'packages'),
(entities.Repository, 'remove_content'),
Expand Down Expand Up @@ -2165,6 +2166,7 @@ def setUpClass(cls):
(entities.PuppetClass(**generic).list_scparams, 'get'),
(entities.RHCIDeployment(**generic).deploy, 'put'),
(entities.RecurringLogic(**generic).cancel, 'post'),
(entities.Repository(**generic).docker_manifests, 'get'),
(entities.Repository(**generic).errata, 'get'),
(entities.Repository(**generic).packages, 'get'),
(entities.Repository(**generic).module_streams, 'get'),
Expand Down

0 comments on commit 71e6a96

Please sign in to comment.