Parcourir la source

Merge pull request #1706 from aanand/bump-1.3.3

Bump 1.3.3
Aanand Prasad il y a 10 ans
Parent
commit
29ceef6d93

+ 8 - 0
CHANGES.md

@@ -1,6 +1,14 @@
 Change log
 ==========
 
+1.3.3 (2015-07-15)
+------------------
+
+Two regressions have been fixed:
+
+- When stopping containers gracefully, Compose was setting the timeout to 0, effectively forcing a SIGKILL every time.
+- Compose would sometimes crash depending on the formatting of container data returned from the Docker API.
+
 1.3.2 (2015-07-14)
 ------------------
 

+ 1 - 1
compose/__init__.py

@@ -1,3 +1,3 @@
 from __future__ import unicode_literals
 
-__version__ = '1.3.2'
+__version__ = '1.3.3'

+ 3 - 3
compose/cli/main.py

@@ -403,7 +403,7 @@ class TopLevelCommand(Command):
           -t, --timeout TIMEOUT      Specify a shutdown timeout in seconds.
                                      (default: 10)
         """
-        timeout = float(options.get('--timeout') or DEFAULT_TIMEOUT)
+        timeout = int(options.get('--timeout') or DEFAULT_TIMEOUT)
         project.stop(service_names=options['SERVICE'], timeout=timeout)
 
     def restart(self, project, options):
@@ -416,7 +416,7 @@ class TopLevelCommand(Command):
           -t, --timeout TIMEOUT      Specify a shutdown timeout in seconds.
                                      (default: 10)
         """
-        timeout = float(options.get('--timeout') or DEFAULT_TIMEOUT)
+        timeout = int(options.get('--timeout') or DEFAULT_TIMEOUT)
         project.restart(service_names=options['SERVICE'], timeout=timeout)
 
     def up(self, project, options):
@@ -459,7 +459,7 @@ class TopLevelCommand(Command):
         allow_recreate = not options['--no-recreate']
         smart_recreate = options['--x-smart-recreate']
         service_names = options['SERVICE']
-        timeout = float(options.get('--timeout') or DEFAULT_TIMEOUT)
+        timeout = int(options.get('--timeout') or DEFAULT_TIMEOUT)
 
         project.up(
             service_names=service_names,

+ 1 - 1
compose/legacy.py

@@ -149,7 +149,7 @@ def _get_legacy_containers_iter(
 
     for service in services:
         for container in containers:
-            if LABEL_VERSION in container['Labels']:
+            if LABEL_VERSION in (container.get('Labels') or {}):
                 continue
 
             name = get_container_name(container)

+ 1 - 1
docs/install.md

@@ -27,7 +27,7 @@ First, install Docker version 1.6 or greater:
 
 To install Compose, run the following commands:
 
-    curl -L https://github.com/docker/compose/releases/download/1.3.2/docker-compose-`uname -s`-`uname -m` > /usr/local/bin/docker-compose
+    curl -L https://github.com/docker/compose/releases/download/1.3.3/docker-compose-`uname -s`-`uname -m` > /usr/local/bin/docker-compose
     chmod +x /usr/local/bin/docker-compose
 
 > Note: If you get a "Permission denied" error, your `/usr/local/bin` directory probably isn't writable and you'll need to install Compose as the superuser. Run `sudo -i`, then the two commands above, then `exit`.

+ 17 - 0
tests/integration/legacy_test.py

@@ -1,4 +1,5 @@
 import unittest
+from mock import Mock
 
 from docker.errors import APIError
 
@@ -64,6 +65,22 @@ class UtilitiesTestCase(unittest.TestCase):
             legacy.is_valid_name("composetest_web_lol_1", one_off=True),
         )
 
+    def test_get_legacy_containers_no_labels(self):
+        client = Mock()
+        client.containers.return_value = [
+            {
+                "Id": "abc123",
+                "Image": "def456",
+                "Name": "composetest_web_1",
+                "Labels": None,
+            },
+        ]
+
+        containers = list(legacy.get_legacy_containers(
+            client, "composetest", ["web"]))
+
+        self.assertEqual(len(containers), 1)
+
 
 class LegacyTestCase(DockerClientTestCase):
 

+ 2 - 2
tests/integration/state_test.py

@@ -13,7 +13,7 @@ from .testcases import DockerClientTestCase
 class ProjectTestCase(DockerClientTestCase):
     def run_up(self, cfg, **kwargs):
         kwargs.setdefault('smart_recreate', True)
-        kwargs.setdefault('timeout', 0.1)
+        kwargs.setdefault('timeout', 1)
 
         project = self.make_project(cfg)
         project.up(**kwargs)
@@ -171,7 +171,7 @@ def converge(service,
         plan,
         insecure_registry=insecure_registry,
         do_build=do_build,
-        timeout=0.1,
+        timeout=1,
     )