MXS-1949: Fix user injection warning
If a service has no active servers and users are injected, a warning would be logged. This is a misleading warning if the service has no servers and should only be logged if the failure to load any users is an unexpected situation.
This commit is contained in:
@ -567,6 +567,19 @@ static bool add_service_user(SERV_LISTENER *port)
|
|||||||
return rval;
|
return rval;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static bool service_has_servers(SERVICE* service)
|
||||||
|
{
|
||||||
|
for (SERVER_REF* s = service->dbref; s; s = s->next)
|
||||||
|
{
|
||||||
|
if (s->active)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Load MySQL authentication users
|
* @brief Load MySQL authentication users
|
||||||
*
|
*
|
||||||
@ -623,9 +636,12 @@ static int mysql_auth_load_users(SERV_LISTENER *port)
|
|||||||
|
|
||||||
if (injected)
|
if (injected)
|
||||||
{
|
{
|
||||||
MXS_NOTICE("[%s] No users were loaded but 'inject_service_user' is enabled. "
|
if (service_has_servers(service))
|
||||||
"Enabling service credentials for authentication until "
|
{
|
||||||
"database users have been successfully loaded.", service->name);
|
MXS_NOTICE("[%s] No users were loaded but 'inject_service_user' is enabled. "
|
||||||
|
"Enabling service credentials for authentication until "
|
||||||
|
"database users have been successfully loaded.", service->name);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else if (loaded == 0 && !first_load)
|
else if (loaded == 0 && !first_load)
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user