mirror of https://github.com/docker/compose.git
Config now catches undefined service links Fixes issue #2922 Signed-off-by: John Harris <john@johnharris.io>
This commit is contained in:
parent
2a8c2c8ad6
commit
e4d2d7ed8a
|
@ -37,6 +37,7 @@ from .validation import validate_against_config_schema
|
|||
from .validation import validate_config_section
|
||||
from .validation import validate_depends_on
|
||||
from .validation import validate_extends_file_path
|
||||
from .validation import validate_links
|
||||
from .validation import validate_network_mode
|
||||
from .validation import validate_service_constraints
|
||||
from .validation import validate_top_level_object
|
||||
|
@ -580,6 +581,7 @@ def validate_service(service_config, service_names, version):
|
|||
validate_ulimits(service_config)
|
||||
validate_network_mode(service_config, service_names)
|
||||
validate_depends_on(service_config, service_names)
|
||||
validate_links(service_config, service_names)
|
||||
|
||||
if not service_dict.get('image') and has_uppercase(service_name):
|
||||
raise ConfigurationError(
|
||||
|
|
|
@ -171,6 +171,14 @@ def validate_network_mode(service_config, service_names):
|
|||
"is undefined.".format(s=service_config, dep=dependency))
|
||||
|
||||
|
||||
def validate_links(service_config, service_names):
|
||||
for dependency in service_config.config.get('links', []):
|
||||
if dependency not in service_names:
|
||||
raise ConfigurationError(
|
||||
"Service '{s.name}' has a link to service '{dep}' which is "
|
||||
"undefined.".format(s=service_config, dep=dependency))
|
||||
|
||||
|
||||
def validate_depends_on(service_config, service_names):
|
||||
for dependency in service_config.config.get('depends_on', []):
|
||||
if dependency not in service_names:
|
||||
|
|
Loading…
Reference in New Issue