libcloud-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From anthonys...@apache.org
Subject [2/4] libcloud git commit: update request for start_container, it doesn't send data any more
Date Mon, 19 Jun 2017 00:23:03 GMT
update request for start_container, it doesn't send data any more


Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo
Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/09794443
Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/09794443
Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/09794443

Branch: refs/heads/trunk
Commit: 09794443e488058d93a8f7046bbe85657d3a6142
Parents: 238db6d
Author: johnnyWalnut <ikarydis0@gmail.com>
Authored: Fri Apr 28 14:02:03 2017 +0300
Committer: Anthony Shaw <anthonyshaw@apache.org>
Committed: Mon Jun 19 10:21:38 2017 +1000

----------------------------------------------------------------------
 libcloud/container/drivers/docker.py | 39 ++++++++++++++++++++-----------
 1 file changed, 26 insertions(+), 13 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/libcloud/blob/09794443/libcloud/container/drivers/docker.py
----------------------------------------------------------------------
diff --git a/libcloud/container/drivers/docker.py b/libcloud/container/drivers/docker.py
index 26f550a..877abe7 100644
--- a/libcloud/container/drivers/docker.py
+++ b/libcloud/container/drivers/docker.py
@@ -387,10 +387,16 @@ class DockerContainerDriver(ContainerDriver):
 
         data = json.dumps(payload)
         if start:
-            result = self.connection.request(
-                '/v%s/containers/%s/start' %
-                (self.version, id_), data=data,
-                method='POST')
+            if float(self._get_api_version()) > 1.22:
+                result = self.connection.request(
+                    '/v%s/containers/%s/start' %
+                    (self.version, id_),
+                    method='POST')
+            else:
+                result = self.connection.request(
+                    '/v%s/containers/%s/start' %
+                    (self.version, id_), data=data,
+                    method='POST')
 
         return self.get_container(id_)
 
@@ -418,15 +424,22 @@ class DockerContainerDriver(ContainerDriver):
         :return: The container refreshed with current data
         :rtype: :class:`libcloud.container.base.Container`
         """
-        payload = {
-            'Binds': [],
-            'PublishAllPorts': True,
-        }
-        data = json.dumps(payload)
-        result = self.connection.request(
-            '/v%s/containers/%s/start' %
-            (self.version, container.id),
-            method='POST', data=data)
+        if float(self._get_api_version()) > 1.22:
+            result = self.connection.request(
+                '/v%s/containers/%s/start' %
+                (self.version, container.id),
+                method='POST')
+        else:
+            payload = {
+                'Binds': [],
+                'PublishAllPorts': True,
+            }
+            data = json.dumps(payload)
+            result = self.connection.request(
+                '/v%s/containers/%s/start' %
+                (self.version, container.id),
+                method='POST', data=data)
+
         if result.status in VALID_RESPONSE_CODES:
             return self.get_container(container.id)
         else:


Mime
View raw message