From 3e08f606ba879b90eac052320b45bd834c45c94d Mon Sep 17 00:00:00 2001 From: Satellite QE <115476073+Satellite-QE@users.noreply.github.com> Date: Fri, 25 Oct 2024 08:02:52 -0400 Subject: [PATCH] Add possibility to query deb packages for host (#1233) (#1237) (cherry picked from commit 5dee74cd510d19b5e18ed6023701b00441114180) Co-authored-by: dosas --- nailgun/entities.py | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/nailgun/entities.py b/nailgun/entities.py index de760d30..fec36673 100644 --- a/nailgun/entities.py +++ b/nailgun/entities.py @@ -4516,6 +4516,24 @@ def packages(self, synchronous=True, timeout=None, **kwargs): response = client.get(self.path('packages'), **kwargs) return _handle_response(response, self._server_config, synchronous, timeout) + def debs(self, synchronous=True, timeout=None, **kwargs): + """List debian packages installed on the host. + + :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 content decoded. + :raises: ``requests.exceptions.HTTPError`` If the server responds with + an HTTP 4XX or 5XX message. + """ + kwargs = kwargs.copy() # shadow the passed-in kwargs + kwargs.update(self._server_config.get_client_kwargs()) + response = client.get(self.path('debs'), **kwargs) + return _handle_response(response, self._server_config, synchronous, timeout) + def module_streams(self, synchronous=True, timeout=None, **kwargs): """List module_streams available for the host. @@ -4778,6 +4796,7 @@ def path(self, which=None): 'errata/applicability', 'facts', 'packages', + 'debs', 'play_roles', 'power', 'puppetclass_ids',