From fffcc05a8e2c8115991d456992b928b804199157 Mon Sep 17 00:00:00 2001 From: Joffrey F Date: Mon, 11 Dec 2017 11:03:19 -0800 Subject: [PATCH 1/2] Add stop_grace_period to ALLOWED_KEYS Signed-off-by: Joffrey F --- compose/config/config.py | 1 + tests/unit/config/config_test.py | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/compose/config/config.py b/compose/config/config.py index 51391fc7b..95c12d1cc 100644 --- a/compose/config/config.py +++ b/compose/config/config.py @@ -126,6 +126,7 @@ ALLOWED_KEYS = DOCKER_CONFIG_KEYS + [ 'network_mode', 'init', 'scale', + 'stop_grace_period', ] DOCKER_VALID_URL_PREFIXES = ( diff --git a/tests/unit/config/config_test.py b/tests/unit/config/config_test.py index 122ab2ef9..e16e4bfa1 100644 --- a/tests/unit/config/config_test.py +++ b/tests/unit/config/config_test.py @@ -1150,7 +1150,8 @@ class ConfigTest(unittest.TestCase): 'volumes': [ {'source': '/a', 'target': '/b', 'type': 'bind'}, {'source': 'vol', 'target': '/x', 'type': 'volume', 'read_only': True} - ] + ], + 'stop_grace_period': '30s', } }, 'volumes': {'vol': {}} @@ -1177,6 +1178,7 @@ class ConfigTest(unittest.TestCase): '/c:/b:rw', {'source': 'vol', 'target': '/x', 'type': 'volume', 'read_only': True} ] + assert service_dicts[0]['stop_grace_period'] == '30s' @mock.patch.dict(os.environ) def test_volume_mode_override(self): From c2a5dd4c89312aea63195f4f8620346de83d4e4b Mon Sep 17 00:00:00 2001 From: Joffrey F Date: Mon, 11 Dec 2017 11:03:46 -0800 Subject: [PATCH 2/2] Re-align docstring Signed-off-by: Joffrey F --- compose/cli/main.py | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/compose/cli/main.py b/compose/cli/main.py index 222f7d013..46c6b9652 100644 --- a/compose/cli/main.py +++ b/compose/cli/main.py @@ -365,17 +365,17 @@ class TopLevelCommand(object): Usage: down [options] Options: - --rmi type Remove images. Type must be one of: - 'all': Remove all images used by any service. - 'local': Remove only images that don't have a custom tag - set by the `image` field. - -v, --volumes Remove named volumes declared in the `volumes` section - of the Compose file and anonymous volumes - attached to containers. - --remove-orphans Remove containers for services not defined in the - Compose file - -t, --timeout TIMEOUT Specify a shutdown timeout in seconds. - (default: 10) + --rmi type Remove images. Type must be one of: + 'all': Remove all images used by any service. + 'local': Remove only images that don't have a + custom tag set by the `image` field. + -v, --volumes Remove named volumes declared in the `volumes` + section of the Compose file and anonymous volumes + attached to containers. + --remove-orphans Remove containers for services not defined in the + Compose file + -t, --timeout TIMEOUT Specify a shutdown timeout in seconds. + (default: 10) """ image_type = image_type_from_opt('--rmi', options['--rmi']) timeout = timeout_from_opts(options)