|
@@ -27,6 +27,7 @@ from .types import VolumeFromSpec
|
|
|
from .types import VolumeSpec
|
|
|
from .validation import validate_against_fields_schema
|
|
|
from .validation import validate_against_service_schema
|
|
|
+from .validation import validate_depends_on
|
|
|
from .validation import validate_extends_file_path
|
|
|
from .validation import validate_top_level_object
|
|
|
from .validation import validate_top_level_service_objects
|
|
@@ -312,9 +313,10 @@ def load_services(working_dir, config_file, service_configs):
|
|
|
resolver = ServiceExtendsResolver(service_config, config_file)
|
|
|
service_dict = process_service(resolver.run())
|
|
|
|
|
|
- validate_service(service_dict, service_config.name, config_file.version)
|
|
|
+ service_config = service_config._replace(config=service_dict)
|
|
|
+ validate_service(service_config, service_names, config_file.version)
|
|
|
service_dict = finalize_service(
|
|
|
- service_config._replace(config=service_dict),
|
|
|
+ service_config,
|
|
|
service_names,
|
|
|
config_file.version)
|
|
|
return service_dict
|
|
@@ -481,6 +483,10 @@ def validate_extended_service_dict(service_dict, filename, service):
|
|
|
raise ConfigurationError(
|
|
|
"%s services with 'net: container' cannot be extended" % error_prefix)
|
|
|
|
|
|
+ if 'depends_on' in service_dict:
|
|
|
+ raise ConfigurationError(
|
|
|
+ "%s services with 'depends_on' cannot be extended" % error_prefix)
|
|
|
+
|
|
|
|
|
|
def validate_ulimits(ulimit_config):
|
|
|
for limit_name, soft_hard_values in six.iteritems(ulimit_config):
|
|
@@ -491,13 +497,16 @@ def validate_ulimits(ulimit_config):
|
|
|
"than 'hard' value".format(ulimit_config))
|
|
|
|
|
|
|
|
|
-def validate_service(service_dict, service_name, version):
|
|
|
+def validate_service(service_config, service_names, version):
|
|
|
+ service_dict, service_name = service_config.config, service_config.name
|
|
|
validate_against_service_schema(service_dict, service_name, version)
|
|
|
validate_paths(service_dict)
|
|
|
|
|
|
if 'ulimits' in service_dict:
|
|
|
validate_ulimits(service_dict['ulimits'])
|
|
|
|
|
|
+ validate_depends_on(service_config, service_names)
|
|
|
+
|
|
|
if not service_dict.get('image') and has_uppercase(service_name):
|
|
|
raise ConfigurationError(
|
|
|
"Service '{name}' contains uppercase characters which are not valid "
|