diff --git a/nailgun/entities.py b/nailgun/entities.py index dcde6ad6..a238040c 100644 --- a/nailgun/entities.py +++ b/nailgun/entities.py @@ -2618,11 +2618,13 @@ def path(self, which=None): /content_view_versions//promote verify_checksum /content_view_versions//verify_checksum + republish_repositories + /content_view_versions//republish_repositories ``super`` is called otherwise. """ - if which in ("incremental_update", "promote", "verify_checksum"): + if which in ("incremental_update", "promote", "verify_checksum", "republish_repositories"): prefix = "base" if which == "incremental_update" else "self" return f"{super().path(prefix)}/{which}" return super().path(which) @@ -2684,6 +2686,25 @@ def verify_checksum(self, synchronous=True, timeout=None, **kwargs): response = client.post(self.path('verify_checksum'), **kwargs) return _handle_response(response, self._server_config, synchronous, timeout) + def republish_repositories(self, synchronous=True, timeout=None, **kwargs): + """Force a republish of the version's repositories' metadata. + + :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 JSON 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('republish_repositories'), **kwargs) + return _handle_response(response, self._server_config, synchronous, timeout) + class ContentViewFilterRule( Entity, @@ -6839,6 +6860,7 @@ def __init__(self, server_config=None, **kwargs): default='yum', required=True, ), + 'is_container_push': entity_fields.BooleanField(default=False), 'container_repository_name': entity_fields.StringField(), # Just setting `str_type='alpha'` will fail with this error: # {"docker_upstream_name":["must be a valid docker name"]}} @@ -6973,6 +6995,25 @@ def docker_manifests(self, synchronous=True, timeout=None, **kwargs): response = client.get(self.path('docker_manifests'), **kwargs) return _handle_response(response, self._server_config, synchronous, timeout) + def delete_with_args(self, synchronous=True, timeout=None, **kwargs): + """Delete a repository, and respect args passed to it. + + :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 JSON 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.delete(self.path(), **kwargs) + return _handle_response(response, self._server_config, synchronous, timeout) + def errata(self, synchronous=True, timeout=None, **kwargs): """List errata inside repository. diff --git a/tests/test_entities.py b/tests/test_entities.py index 96d08019..ef1dd084 100644 --- a/tests/test_entities.py +++ b/tests/test_entities.py @@ -311,6 +311,7 @@ def test_id_and_which(self): (entities.ContentView, 'publish'), (entities.ContentViewVersion, 'promote'), (entities.ContentViewVersion, 'verify_checksum'), + (entities.ContentViewVersion, 'republish_repositories'), (entities.DiscoveredHost, 'auto_provision'), (entities.DiscoveredHost, 'refresh_facts'), (entities.DiscoveredHost, 'reboot'), @@ -344,6 +345,7 @@ def test_id_and_which(self): (entities.Product, 'sync'), (entities.PuppetClass, 'smart_class_parameters'), (entities.Repository, 'docker_manifests'), + (entities.Repository, 'delete_with_args'), (entities.Repository, 'errata'), (entities.Repository, 'packages'), (entities.Repository, 'remove_content'),