Skip to content

Commit 972a39a

Browse files
authored
Add bulk applicable and installable errata endpoints (#1375)
1 parent a31ba3b commit 972a39a

File tree

2 files changed

+42
-0
lines changed

2 files changed

+42
-0
lines changed

nailgun/entities.py

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4726,6 +4726,44 @@ def bulk_available_incremental_updates(self, synchronous=True, timeout=None, **k
47264726
response = client.post(self.path('bulk/available_incremental_updates'), **kwargs)
47274727
return _handle_response(response, self._server_config, synchronous, timeout)
47284728

4729+
def bulk_applicable_errata(self, synchronous=True, timeout=None, **kwargs):
4730+
"""Fetch applicable errata for one or more hosts.
4731+
4732+
:param synchronous: What should happen if the server returns an HTTP
4733+
202 (accepted) status code? Wait for the task to complete if
4734+
``True``. Immediately return the server's response otherwise.
4735+
:param timeout: Maximum number of seconds to wait until timing out.
4736+
Defaults to ``nailgun.entity_mixins.TASK_TIMEOUT``.
4737+
:param kwargs: Arguments to pass to requests.
4738+
:returns: The server's response, with all content decoded.
4739+
:raises: ``requests.exceptions.HTTPError`` If the server responds with
4740+
an HTTP 4XX or 5XX message.
4741+
4742+
"""
4743+
kwargs = kwargs.copy() # shadow the passed-in kwargs
4744+
kwargs.update(self._server_config.get_client_kwargs())
4745+
response = client.post(self.path('bulk/applicable_errata'), **kwargs)
4746+
return _handle_response(response, self._server_config, synchronous, timeout)
4747+
4748+
def bulk_installable_errata(self, synchronous=True, timeout=None, **kwargs):
4749+
"""Fetch installable errata for one or more hosts.
4750+
4751+
:param synchronous: What should happen if the server returns an HTTP
4752+
202 (accepted) status code? Wait for the task to complete if
4753+
``True``. Immediately return the server's response otherwise.
4754+
:param timeout: Maximum number of seconds to wait until timing out.
4755+
Defaults to ``nailgun.entity_mixins.TASK_TIMEOUT``.
4756+
:param kwargs: Arguments to pass to requests.
4757+
:returns: The server's response, with all content decoded.
4758+
:raises: ``requests.exceptions.HTTPError`` If the server responds with
4759+
an HTTP 4XX or 5XX message.
4760+
4761+
"""
4762+
kwargs = kwargs.copy() # shadow the passed-in kwargs
4763+
kwargs.update(self._server_config.get_client_kwargs())
4764+
response = client.post(self.path('bulk/installable_errata'), **kwargs)
4765+
return _handle_response(response, self._server_config, synchronous, timeout)
4766+
47294767
def get_facts(self, synchronous=True, timeout=None, **kwargs):
47304768
"""List all fact values of a given host.
47314769
@@ -4925,6 +4963,8 @@ def path(self, which=None):
49254963
elif which in (
49264964
'bootc_images',
49274965
'bulk/available_incremental_updates',
4966+
'bulk/applicable_errata',
4967+
'bulk/installable_errata',
49284968
'bulk/traces',
49294969
'bulk/resolve_traces',
49304970
'bulk/destroy',

tests/test_entities.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2148,6 +2148,8 @@ def setUpClass(cls):
21482148
(entities.Host(**generic).bulk_destroy, 'put'),
21492149
(entities.Host(**generic).bulk_traces, 'post'),
21502150
(entities.Host(**generic).bulk_resolve_traces, 'put'),
2151+
(entities.Host(**generic).bulk_applicable_errata, 'post'),
2152+
(entities.Host(**generic).bulk_installable_errata, 'post'),
21512153
(entities.HostGroup(**generic).add_puppetclass, 'post'),
21522154
(entities.HostGroup(**generic).assign_ansible_roles, 'post'),
21532155
(entities.HostGroup(**generic).clone, 'post'),

0 commit comments

Comments
 (0)