You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@libcloud.apache.org by an...@apache.org on 2016/10/08 02:30:35 UTC
[04/27] libcloud git commit: properly parse_error now
properly parse_error now
Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo
Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/5b17bdf6
Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/5b17bdf6
Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/5b17bdf6
Branch: refs/heads/trunk
Commit: 5b17bdf6fb4fadbf37226302d47350e0701bae65
Parents: 4b497e6
Author: Mario Loria <ma...@arroyonetworks.com>
Authored: Fri Oct 7 14:22:57 2016 -0400
Committer: Anthony Shaw <an...@apache.org>
Committed: Sat Oct 8 13:29:22 2016 +1100
----------------------------------------------------------------------
libcloud/container/drivers/rancher.py | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/libcloud/blob/5b17bdf6/libcloud/container/drivers/rancher.py
----------------------------------------------------------------------
diff --git a/libcloud/container/drivers/rancher.py b/libcloud/container/drivers/rancher.py
index f627692..9bf810a 100644
--- a/libcloud/container/drivers/rancher.py
+++ b/libcloud/container/drivers/rancher.py
@@ -38,6 +38,10 @@ VALID_RESPONSE_CODES = [httplib.OK, httplib.ACCEPTED, httplib.CREATED,
class RancherResponse(JsonResponse):
+ def parse_error(self):
+ parsed = super(RancherResponse, self).parse_error()
+ return "%s - %s" % (parsed['message'], parsed['detail'])
+
def success(self):
return self.status in VALID_RESPONSE_CODES
@@ -606,7 +610,10 @@ class RancherContainerDriver(ContainerDriver):
"""
result = self.connection.request('%s/containers/%s' % (self.baseuri,
container.id), method='DELETE')
- return result.status in VALID_RESPONSE_CODES
+ if result.status in VALID_RESPONSE_CODES:
+ return self.get_container(container.id)
+ else:
+ raise RancherException(result.status, 'failed to stop container')
def _gen_image(self, imageuuid):
"""