Move named volumes matching to config validation phase

Signed-off-by: Joffrey F <joffrey@docker.com>
This commit is contained in:
Joffrey F 2016-01-22 17:42:24 -08:00
commit 139c7f7830
5 changed files with 83 additions and 74 deletions

View file

@ -77,6 +77,18 @@ def format_boolean_in_environment(instance):
return True
def match_named_volumes(service_dict, project_volumes):
service_volumes = service_dict.get('volumes', [])
for volume_spec in service_volumes:
if volume_spec.is_named_volume and volume_spec.external not in project_volumes:
raise ConfigurationError(
'Named volume "{0}" is used in service "{1}" but no'
' declaration was found in the volumes section.'.format(
volume_spec.repr(), service_dict.get('name')
)
)
def validate_top_level_service_objects(filename, service_dicts):
"""Perform some high level validation of the service name and value.