Fix external secrets serialization

Signed-off-by: Joffrey F <joffrey@docker.com>
This commit is contained in:
Joffrey F 2017-05-01 14:29:37 -07:00
parent f2d3ac680e
commit f94cf103d6
2 changed files with 7 additions and 2 deletions

View File

@ -51,7 +51,10 @@ def denormalize_config(config, image_digests=None):
del vol_conf['external_name']
if config.version in (V3_1, V3_2):
result['secrets'] = config.secrets
result['secrets'] = config.secrets.copy()
for secret_name, secret_conf in result['secrets'].items():
if 'external_name' in secret_conf:
del secret_conf['external_name']
return result

View File

@ -3825,7 +3825,8 @@ class SerializeTest(unittest.TestCase):
}
secrets_dict = {
'one': {'file': '/one.txt'},
'source': {'file': '/source.pem'}
'source': {'file': '/source.pem'},
'two': {'external': True},
}
config_dict = config.load(build_config_details({
'version': '3.1',
@ -3837,6 +3838,7 @@ class SerializeTest(unittest.TestCase):
serialized_service = serialized_config['services']['web']
assert secret_sort(serialized_service['secrets']) == secret_sort(service_dict['secrets'])
assert 'secrets' in serialized_config
assert serialized_config['secrets']['two'] == secrets_dict['two']
def test_serialize_ports(self):
config_dict = config.Config(version='2.0', services=[