diff --git a/nailgun/entities.py b/nailgun/entities.py index fe18435f..359ff640 100644 --- a/nailgun/entities.py +++ b/nailgun/entities.py @@ -523,6 +523,8 @@ def path(self, which=None): /katello/api/alternate_content_sources/:id/refresh bulk_refresh /katello/api/alternate_content_sources/bulk/refresh + bulk_refresh_all + /katello/api/alternate_content_sources/bulk/refresh_all bulk_destroy /katello/api/alternate_content_sources/bulk/destroy """ @@ -530,6 +532,7 @@ def path(self, which=None): return f'{super().path(which="self")}/{which}' elif which in ( 'bulk/refresh', + 'bulk/refresh_all', 'bulk/destroy', ): return f'{super().path(which="base")}/{which}' @@ -554,6 +557,24 @@ def refresh(self, synchronous=True, timeout=None, **kwargs): response = client.post(self.path('refresh'), **kwargs) return _handle_response(response, self._server_config, synchronous, timeout) + def bulk_refresh_all(self, synchronous=True, timeout=None, **kwargs): + """Refresh all ACSes present. + + :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.post(self.path('bulk/refresh_all'), **kwargs) + return _handle_response(response, self._server_config, synchronous, timeout) + def bulk_refresh(self, synchronous=True, timeout=None, **kwargs): """Refresh the set of ACSes. diff --git a/tests/test_entities.py b/tests/test_entities.py index 4e09a81a..60a26c37 100644 --- a/tests/test_entities.py +++ b/tests/test_entities.py @@ -360,6 +360,7 @@ def test_noid_and_which(self): """Execute ``entity().path(which=…)``.""" for entity, which in ( (entities.AlternateContentSource, 'bulk/refresh'), + (entities.AlternateContentSource, 'bulk/refresh-all'), (entities.AlternateContentSource, 'bulk/destroy'), (entities.AnsibleRoles, 'sync'), (entities.AnsiblePlaybooks, 'sync'),