Kami commented on a change in pull request #1478:
URL: https://github.com/apache/libcloud/pull/1478#discussion_r464069754
##########
File path: libcloud/container/drivers/lxd.py
##########
@@ -662,10 +730,17 @@ def destroy_container(self, container,
ex_timeout=default_time_out):
# Return: background operation or standard error
req = '/%s/containers/%s' % (self.version, container.name)
- response = self.connection.request(req, method='DELETE')
- response_dict = response.parse_body()
- assert_response(response_dict=response_dict, status_code=100)
+ try:
+ response = self.connection.request(req, method='DELETE')
+
+ response_dict = response.parse_body()
+ assert_response(response_dict=response_dict, status_code=100)
+ except BaseHTTPError as e:
+ # handle the case where the container is running
+ message_list = e.message.split(",")
Review comment:
EDIT: Or perhaps even, ``_get_lxd_ap_exception_for_error`` and returning
``LXDAPIException`` class instance.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]