def validate_service_definitions(components_map, components=None):
if not components:
components = components_map.keys()
else:
validation_base.validate_components_names(components, components_map)
not_passed_components = set()
for component in components:
try:
jsonschema.validate(components_map[component]["service_content"],
SERVICE_SCHEMA,
format_checker=ServiceFormatChecker())
except jsonschema.ValidationError as e:
LOG.error("Validation of service definitions for component '%s' "
"is not passed: '%s'", component, e.message)
not_passed_components.add(component)
if not_passed_components:
raise RuntimeError(
"Validation of service definitions for {} of {} components is "
"not passed.".format(len(not_passed_components), len(components))
)
else:
LOG.info("Service definitions validation passed successfully")
评论列表
文章目录