diff --git a/nailgun/entities.py b/nailgun/entities.py index 0df05a72..c2b64d66 100644 --- a/nailgun/entities.py +++ b/nailgun/entities.py @@ -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. @@ -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', diff --git a/tests/test_entities.py b/tests/test_entities.py index 9f5b1195..a20c907b 100644 --- a/tests/test_entities.py +++ b/tests/test_entities.py @@ -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'),