diff --git a/CHANGES.md b/CHANGES.md index b87a2e7dee..38a5432499 100644 --- a/CHANGES.md +++ b/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) ------------------ diff --git a/compose/__init__.py b/compose/__init__.py index 1f69574951..97d9c11d97 100644 --- a/compose/__init__.py +++ b/compose/__init__.py @@ -1,3 +1,3 @@ from __future__ import unicode_literals -__version__ = '1.3.2' +__version__ = '1.3.3' diff --git a/compose/cli/main.py b/compose/cli/main.py index d5d15177c0..ba44457350 100644 --- a/compose/cli/main.py +++ b/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, diff --git a/compose/legacy.py b/compose/legacy.py index c9ec658178..6fbf74d692 100644 --- a/compose/legacy.py +++ b/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) diff --git a/docs/install.md b/docs/install.md index cdaac34f36..c025469b6c 100644 --- a/docs/install.md +++ b/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`. diff --git a/tests/integration/legacy_test.py b/tests/integration/legacy_test.py index 806b9a457d..f79089b207 100644 --- a/tests/integration/legacy_test.py +++ b/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): diff --git a/tests/integration/state_test.py b/tests/integration/state_test.py index 95fcc49de5..fb91bc2495 100644 --- a/tests/integration/state_test.py +++ b/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, )