diff --git a/compose/config/config.py b/compose/config/config.py index 5a0a3c847..225919415 100644 --- a/compose/config/config.py +++ b/compose/config/config.py @@ -490,11 +490,12 @@ def process_config_file(config_file, environment, service_name=None): config_file.get_networks(), 'network', environment) - processed_config['secrets'] = interpolate_config_section( - config_file, - config_file.get_secrets(), - 'secrets', - environment) + if config_file.version in (const.COMPOSEFILE_V3_1, const.COMPOSEFILE_V3_2): + processed_config['secrets'] = interpolate_config_section( + config_file, + config_file.get_secrets(), + 'secrets', + environment) else: processed_config = services diff --git a/compose/config/config_schema_v3.2.json b/compose/config/config_schema_v3.2.json index e47c879a4..ea702fcd5 100644 --- a/compose/config/config_schema_v3.2.json +++ b/compose/config/config_schema_v3.2.json @@ -1,6 +1,6 @@ { "$schema": "http://json-schema.org/draft-04/schema#", - "id": "config_schema_v3.1.json", + "id": "config_schema_v3.2.json", "type": "object", "required": ["version"], @@ -169,8 +169,7 @@ "type": "array", "items": { "oneOf": [ - {"type": "number", "format": "ports"}, - {"type": "string", "format": "ports"}, + {"type": ["string", "number"], "format": "ports"}, { "type": "object", "properties": { diff --git a/compose/config/serialize.py b/compose/config/serialize.py index 46e1d9f44..1de1f14fb 100644 --- a/compose/config/serialize.py +++ b/compose/config/serialize.py @@ -4,10 +4,11 @@ from __future__ import unicode_literals import six import yaml -from compose import const from compose.config import types from compose.const import COMPOSEFILE_V1 as V1 from compose.const import COMPOSEFILE_V2_1 as V2_1 +from compose.const import COMPOSEFILE_V3_1 as V3_1 +from compose.const import COMPOSEFILE_V3_1 as V3_2 def serialize_config_type(dumper, data): @@ -45,7 +46,7 @@ def denormalize_config(config): if 'external_name' in vol_conf: del vol_conf['external_name'] - if config.version in (V3_1,): + if config.version in (V3_1, V3_2): result['secrets'] = config.secrets return result @@ -103,7 +104,7 @@ def denormalize_service_dict(service_dict, version): service_dict['healthcheck']['timeout'] ) - if 'ports' in service_dict and version < const.COMPOSEFILE_V3_2: + if 'ports' in service_dict and version not in (V3_2,): service_dict['ports'] = map( lambda p: p.legacy_repr() if isinstance(p, types.ServicePort) else p, service_dict['ports']