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:
Markus Mäkelä 2018-07-05 12:49:46 +03:00
parent 33fa9b26fe
commit f44d305a46
No known key found for this signature in database
GPG Key ID: 72D48FCE664F7B19

View File

@ -567,6 +567,19 @@ static bool add_service_user(SERV_LISTENER *port)
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
*
@ -623,9 +636,12 @@ static int mysql_auth_load_users(SERV_LISTENER *port)
if (injected)
{
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);
if (service_has_servers(service))
{
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)
{