diff options
author | Felipe Sateler <fsateler@debian.org> | 2017-11-19 18:23:19 -0300 |
---|---|---|
committer | Felipe Sateler <fsateler@debian.org> | 2017-11-19 18:23:19 -0300 |
commit | cdf1ad50f344b4d3ae694f32df5111350f008f10 (patch) | |
tree | 35a232d0ad24ed27ccc2ad4dfa45f7c7496f55b3 | |
parent | e456def807f6a87156c252bc5dde739aa461de48 (diff) | |
parent | 6d101fb0686a6e380657aaf974bc3efd1471535e (diff) |
New upstream version 1.17.1
-rw-r--r-- | CHANGELOG.md | 8 | ||||
-rw-r--r-- | compose/__init__.py | 2 | ||||
-rw-r--r-- | compose/config/config.py | 23 | ||||
-rwxr-xr-x | script/run/run.sh | 2 | ||||
-rw-r--r-- | tests/unit/config/config_test.py | 55 |
5 files changed, 62 insertions, 28 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md index f531783e..d0be7ea7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,14 @@ Change log ========== +1.17.1 (2017-11-08) +------------------ + +### Bugfixes + +- Fixed a bug that would prevent creating new containers when using + container labels in the list format as part of the service's definition. + 1.17.0 (2017-11-02) ------------------- diff --git a/compose/__init__.py b/compose/__init__.py index 7b0c7d1e..20392ec9 100644 --- a/compose/__init__.py +++ b/compose/__init__.py @@ -1,4 +1,4 @@ from __future__ import absolute_import from __future__ import unicode_literals -__version__ = '1.17.0' +__version__ = '1.17.1' diff --git a/compose/config/config.py b/compose/config/config.py index 7bb57076..d5aaf953 100644 --- a/compose/config/config.py +++ b/compose/config/config.py @@ -706,14 +706,7 @@ def process_service(service_config): ] if 'build' in service_dict: - if isinstance(service_dict['build'], six.string_types): - service_dict['build'] = resolve_build_path(working_dir, service_dict['build']) - elif isinstance(service_dict['build'], dict): - if 'context' in service_dict['build']: - path = service_dict['build']['context'] - service_dict['build']['context'] = resolve_build_path(working_dir, path) - if 'labels' in service_dict['build']: - service_dict['build']['labels'] = parse_labels(service_dict['build']['labels']) + process_build_section(service_dict, working_dir) if 'volumes' in service_dict and service_dict.get('volume_driver') is None: service_dict['volumes'] = resolve_volume_paths(working_dir, service_dict) @@ -721,6 +714,9 @@ def process_service(service_config): if 'sysctls' in service_dict: service_dict['sysctls'] = build_string_dict(parse_sysctls(service_dict['sysctls'])) + if 'labels' in service_dict: + service_dict['labels'] = parse_labels(service_dict['labels']) + service_dict = process_depends_on(service_dict) for field in ['dns', 'dns_search', 'tmpfs']: @@ -734,6 +730,17 @@ def process_service(service_config): return service_dict +def process_build_section(service_dict, working_dir): + if isinstance(service_dict['build'], six.string_types): + service_dict['build'] = resolve_build_path(working_dir, service_dict['build']) + elif isinstance(service_dict['build'], dict): + if 'context' in service_dict['build']: + path = service_dict['build']['context'] + service_dict['build']['context'] = resolve_build_path(working_dir, path) + if 'labels' in service_dict['build']: + service_dict['build']['labels'] = parse_labels(service_dict['build']['labels']) + + def process_ports(service_dict): if 'ports' not in service_dict: return service_dict diff --git a/script/run/run.sh b/script/run/run.sh index 38ce8787..58483196 100755 --- a/script/run/run.sh +++ b/script/run/run.sh @@ -15,7 +15,7 @@ set -e -VERSION="1.17.0" +VERSION="1.17.1" IMAGE="docker/compose:$VERSION" diff --git a/tests/unit/config/config_test.py b/tests/unit/config/config_test.py index 8f2266ed..8e3d4e2e 100644 --- a/tests/unit/config/config_test.py +++ b/tests/unit/config/config_test.py @@ -407,6 +407,32 @@ class ConfigTest(unittest.TestCase): } } + def test_load_config_service_labels(self): + base_file = config.ConfigFile( + 'base.yaml', + { + 'version': '2.1', + 'services': { + 'web': { + 'image': 'example/web', + 'labels': ['label_key=label_val'] + }, + 'db': { + 'image': 'example/db', + 'labels': { + 'label_key': 'label_val' + } + } + }, + } + ) + details = config.ConfigDetails('.', [base_file]) + service_dicts = config.load(details).services + for service in service_dicts: + assert service['labels'] == { + 'label_key': 'label_val' + } + def test_load_config_volume_and_network_labels(self): base_file = config.ConfigFile( 'base.yaml', @@ -435,30 +461,23 @@ class ConfigTest(unittest.TestCase): ) details = config.ConfigDetails('.', [base_file]) - network_dict = config.load(details).networks - volume_dict = config.load(details).volumes + loaded_config = config.load(details) - self.assertEqual( - network_dict, - { - 'with_label': { - 'labels': { - 'label_key': 'label_val' - } + assert loaded_config.networks == { + 'with_label': { + 'labels': { + 'label_key': 'label_val' } } - ) + } - self.assertEqual( - volume_dict, - { - 'with_label': { - 'labels': { - 'label_key': 'label_val' - } + assert loaded_config.volumes == { + 'with_label': { + 'labels': { + 'label_key': 'label_val' } } - ) + } def test_load_config_invalid_service_names(self): for invalid_name in ['?not?allowed', ' ', '', '!', '/', '\xe2']: |