Handle volume driver change error in config.
Assume version=1 if file is empty in get_config_version Empty files are invalid anyway, so this simplifies the algorithm somewhat. https://github.com/docker/compose/pull/2421#discussion_r47223144 Don't leak version considerations in interpolation/service validation Signed-off-by: Joffrey F <joffrey@docker.com>
This commit is contained in:
parent
f3a9533dc0
commit
a7689f3da8
6 changed files with 94 additions and 21 deletions
|
|
@ -74,19 +74,18 @@ def format_boolean_in_environment(instance):
|
|||
return True
|
||||
|
||||
|
||||
def validate_top_level_service_objects(config_file, version):
|
||||
def validate_top_level_service_objects(filename, service_dicts):
|
||||
"""Perform some high level validation of the service name and value.
|
||||
|
||||
This validation must happen before interpolation, which must happen
|
||||
before the rest of validation, which is why it's separate from the
|
||||
rest of the service validation.
|
||||
"""
|
||||
service_dicts = config_file.config if version == 1 else config_file.config.get('services', {})
|
||||
for service_name, service_dict in service_dicts.items():
|
||||
if not isinstance(service_name, six.string_types):
|
||||
raise ConfigurationError(
|
||||
"In file '{}' service name: {} needs to be a string, eg '{}'".format(
|
||||
config_file.filename,
|
||||
filename,
|
||||
service_name,
|
||||
service_name))
|
||||
|
||||
|
|
@ -95,8 +94,9 @@ def validate_top_level_service_objects(config_file, version):
|
|||
"In file '{}' service '{}' doesn\'t have any configuration options. "
|
||||
"All top level keys in your docker-compose.yml must map "
|
||||
"to a dictionary of configuration options.".format(
|
||||
config_file.filename,
|
||||
service_name))
|
||||
filename, service_name
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
def validate_top_level_object(config_file):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue