Skip to content

Commit

Permalink
Add helper to delete LCE from capsule
Browse files Browse the repository at this point in the history
  • Loading branch information
vsedmik committed Jun 14, 2023
1 parent cfed8c9 commit 2b50cba
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions nailgun/entities.py
Original file line number Diff line number Diff line change
Expand Up @@ -858,6 +858,34 @@ def content_add_lifecycle_environment(self, synchronous=True, timeout=None, **kw
response = client.post(self.path('content_lifecycle_environments'), **kwargs)
return _handle_response(response, self._server_config, synchronous, timeout)

def content_delete_lifecycle_environment(self, synchronous=True, timeout=None, **kwargs):
"""Helper to disassociate lifecycle environment from capsule
Here is an example of how to use this method::
capsule.content_delete_lifecycle_environment(data={'environment_id': lce.id})
Constructs path:
/katello/api/capsules/:capsule_id/content/lifecycle_environments/:id
: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()
kwargs.update(self._server_config.get_client_kwargs())
path = (
f'{self.path("content_lifecycle_environments")}/{kwargs["data"].pop("environment_id")}'
)
response = client.delete(path, **kwargs)
return _handle_response(response, self._server_config, synchronous, timeout)

def content_lifecycle_environments(self, synchronous=True, timeout=None, **kwargs):
"""Helper to get all the lifecycle environments, associated with
capsule
Expand Down

0 comments on commit 2b50cba

Please sign in to comment.