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
19 changes: 19 additions & 0 deletions nailgun/entities.py
Original file line number Diff line number Diff line change
Expand Up @@ -4735,6 +4735,24 @@ def bulk_destroy(self, synchronous=True, timeout=None, **kwargs):
response = client.put(self.path('bulk/destroy'), **kwargs)
return _handle_response(response, self._server_config, synchronous, timeout)

def bulk_manage_notifications(self, synchronous=True, timeout=None, **kwargs):
"""Enable or disable email notifications for the specified set of hosts.

:param synchronous: If True, when the server returns an HTTP
202 (accepted) status code, wait for the task to complete. If false,
immediately return the server's response.
: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.put(self.path('bulk/manage_notifications'), **kwargs)
return _handle_response(response, self._server_config, synchronous, timeout)

def packages(self, synchronous=True, timeout=None, **kwargs):
"""List packages installed on the host.

Expand Down Expand Up @@ -5094,6 +5112,7 @@ def path(self, which=None):
'bulk/available_incremental_updates',
'bulk/applicable_errata',
'bulk/installable_errata',
'bulk/manage_notifications',
'bulk/traces',
'bulk/resolve_traces',
'bulk/destroy',
Expand Down
1 change: 1 addition & 0 deletions tests/test_entities.py
Original file line number Diff line number Diff line change
Expand Up @@ -2153,6 +2153,7 @@ def setUpClass(cls):
(entities.Host(**generic).traces, 'get'),
(entities.Host(**generic).resolve_traces, 'put'),
(entities.Host(**generic).bulk_destroy, 'put'),
(entities.Host(**generic).bulk_manage_notifications, 'put'),
(entities.Host(**generic).bulk_traces, 'post'),
(entities.Host(**generic).bulk_resolve_traces, 'put'),
(entities.Host(**generic).bulk_applicable_errata, 'post'),
Expand Down
Loading