Fix error detection in service creation
If a server that did not exist was added to the service, the error would not cause a startup failure.
This commit is contained in:
@ -3734,12 +3734,11 @@ int create_new_service(CONFIG_CONTEXT* obj)
|
|||||||
config_add_defaults(obj, config_service_params);
|
config_add_defaults(obj, config_service_params);
|
||||||
config_add_defaults(obj, module->parameters);
|
config_add_defaults(obj, module->parameters);
|
||||||
|
|
||||||
|
int error_count = 0;
|
||||||
Service* service = service_alloc(obj->object, router, obj->parameters);
|
Service* service = service_alloc(obj->object, router, obj->parameters);
|
||||||
|
|
||||||
if (service)
|
if (service)
|
||||||
{
|
{
|
||||||
int error_count = 0;
|
|
||||||
|
|
||||||
for (auto& a : mxs::strtok(config_get_string(obj->parameters, CN_SERVERS), ","))
|
for (auto& a : mxs::strtok(config_get_string(obj->parameters, CN_SERVERS), ","))
|
||||||
{
|
{
|
||||||
fix_object_name(a);
|
fix_object_name(a);
|
||||||
@ -3771,9 +3770,10 @@ int create_new_service(CONFIG_CONTEXT* obj)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
MXS_ERROR("Service '%s' creation failed.", obj->object);
|
MXS_ERROR("Service '%s' creation failed.", obj->object);
|
||||||
|
error_count++;
|
||||||
}
|
}
|
||||||
|
|
||||||
return service ? 0 : 1;
|
return error_count;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Reference in New Issue
Block a user