mirror of https://github.com/docker/compose.git
Avoid overriding external = False in serializer
Signed-off-by: Joffrey F <joffrey@docker.com>
This commit is contained in:
parent
40631f9a01
commit
9c2ffe6384
|
@ -78,7 +78,7 @@ def denormalize_config(config, image_digests=None):
|
||||||
config.version >= V3_0 and config.version < v3_introduced_name_key(key)):
|
config.version >= V3_0 and config.version < v3_introduced_name_key(key)):
|
||||||
del conf['name']
|
del conf['name']
|
||||||
elif 'external' in conf:
|
elif 'external' in conf:
|
||||||
conf['external'] = True
|
conf['external'] = bool(conf['external'])
|
||||||
|
|
||||||
if 'attachable' in conf and config.version < V3_2:
|
if 'attachable' in conf and config.version < V3_2:
|
||||||
# For compatibility mode, this option is invalid in v2
|
# For compatibility mode, this option is invalid in v2
|
||||||
|
|
|
@ -5096,3 +5096,19 @@ class SerializeTest(unittest.TestCase):
|
||||||
serialized_config = yaml.load(serialize_config(config_dict))
|
serialized_config = yaml.load(serialize_config(config_dict))
|
||||||
serialized_service = serialized_config['services']['web']
|
serialized_service = serialized_config['services']['web']
|
||||||
assert serialized_service['command'] == 'echo 十六夜 咲夜'
|
assert serialized_service['command'] == 'echo 十六夜 咲夜'
|
||||||
|
|
||||||
|
def test_serialize_external_false(self):
|
||||||
|
cfg = {
|
||||||
|
'version': '3.4',
|
||||||
|
'volumes': {
|
||||||
|
'test': {
|
||||||
|
'name': 'test-false',
|
||||||
|
'external': False
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
config_dict = config.load(build_config_details(cfg))
|
||||||
|
serialized_config = yaml.load(serialize_config(config_dict))
|
||||||
|
serialized_volume = serialized_config['volumes']['test']
|
||||||
|
assert serialized_volume['external'] is False
|
||||||
|
|
Loading…
Reference in New Issue