mirror of
https://github.com/docker/compose.git
synced 2025-07-29 16:44:20 +02:00
Fix a handful of issues with 3.2 schema
Signed-off-by: Joffrey F <joffrey@docker.com>
This commit is contained in:
parent
2acf286ed6
commit
7b19009511
@ -490,11 +490,12 @@ def process_config_file(config_file, environment, service_name=None):
|
|||||||
config_file.get_networks(),
|
config_file.get_networks(),
|
||||||
'network',
|
'network',
|
||||||
environment)
|
environment)
|
||||||
processed_config['secrets'] = interpolate_config_section(
|
if config_file.version in (const.COMPOSEFILE_V3_1, const.COMPOSEFILE_V3_2):
|
||||||
config_file,
|
processed_config['secrets'] = interpolate_config_section(
|
||||||
config_file.get_secrets(),
|
config_file,
|
||||||
'secrets',
|
config_file.get_secrets(),
|
||||||
environment)
|
'secrets',
|
||||||
|
environment)
|
||||||
else:
|
else:
|
||||||
processed_config = services
|
processed_config = services
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"$schema": "http://json-schema.org/draft-04/schema#",
|
"$schema": "http://json-schema.org/draft-04/schema#",
|
||||||
"id": "config_schema_v3.1.json",
|
"id": "config_schema_v3.2.json",
|
||||||
"type": "object",
|
"type": "object",
|
||||||
"required": ["version"],
|
"required": ["version"],
|
||||||
|
|
||||||
@ -169,8 +169,7 @@
|
|||||||
"type": "array",
|
"type": "array",
|
||||||
"items": {
|
"items": {
|
||||||
"oneOf": [
|
"oneOf": [
|
||||||
{"type": "number", "format": "ports"},
|
{"type": ["string", "number"], "format": "ports"},
|
||||||
{"type": "string", "format": "ports"},
|
|
||||||
{
|
{
|
||||||
"type": "object",
|
"type": "object",
|
||||||
"properties": {
|
"properties": {
|
||||||
|
@ -4,10 +4,11 @@ from __future__ import unicode_literals
|
|||||||
import six
|
import six
|
||||||
import yaml
|
import yaml
|
||||||
|
|
||||||
from compose import const
|
|
||||||
from compose.config import types
|
from compose.config import types
|
||||||
from compose.const import COMPOSEFILE_V1 as V1
|
from compose.const import COMPOSEFILE_V1 as V1
|
||||||
from compose.const import COMPOSEFILE_V2_1 as V2_1
|
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):
|
def serialize_config_type(dumper, data):
|
||||||
@ -45,7 +46,7 @@ def denormalize_config(config):
|
|||||||
if 'external_name' in vol_conf:
|
if 'external_name' in vol_conf:
|
||||||
del vol_conf['external_name']
|
del vol_conf['external_name']
|
||||||
|
|
||||||
if config.version in (V3_1,):
|
if config.version in (V3_1, V3_2):
|
||||||
result['secrets'] = config.secrets
|
result['secrets'] = config.secrets
|
||||||
return result
|
return result
|
||||||
|
|
||||||
@ -103,7 +104,7 @@ def denormalize_service_dict(service_dict, version):
|
|||||||
service_dict['healthcheck']['timeout']
|
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(
|
service_dict['ports'] = map(
|
||||||
lambda p: p.legacy_repr() if isinstance(p, types.ServicePort) else p,
|
lambda p: p.legacy_repr() if isinstance(p, types.ServicePort) else p,
|
||||||
service_dict['ports']
|
service_dict['ports']
|
||||||
|
Loading…
x
Reference in New Issue
Block a user