From 71e6a969bb03ea03ab3a2e1aace20e08701f8118 Mon Sep 17 00:00:00 2001 From: Vladimir Sedmik Date: Fri, 31 May 2024 14:32:44 +0200 Subject: [PATCH] Add docker_manifests endpoint to repositories --- nailgun/entities.py | 22 ++++++++++++++++++++++ tests/test_entities.py | 2 ++ 2 files changed, 24 insertions(+) diff --git a/nailgun/entities.py b/nailgun/entities.py index 7b6af632..80c14745 100644 --- a/nailgun/entities.py +++ b/nailgun/entities.py @@ -6878,6 +6878,8 @@ def path(self, which=None): The format of the returned path depends on the value of ``which``: + docker_manifests + /repositories//docker_manifests errata /repositories//errata files @@ -6901,6 +6903,7 @@ def path(self, which=None): """ if which in ( + 'docker_manifests', 'errata', 'files', 'packages', @@ -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. diff --git a/tests/test_entities.py b/tests/test_entities.py index 6559470e..96d08019 100644 --- a/tests/test_entities.py +++ b/tests/test_entities.py @@ -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'), @@ -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'),