Use the effective name when looking for a module

Using the effective name means that a module command can be invoked
both using the deprecated name as well as the actual name. E.g.
both using mysqlmon and mariadbmon even though only the last one
actually exists as a module.
This commit is contained in:
Johan Wikman 2017-12-28 11:47:18 +02:00
parent 1fb2608521
commit c48c4c7950

View File

@ -22,6 +22,7 @@
#include <maxscale/spinlock.h>
#include "internal/filter.h"
#include "internal/modules.h"
#include "internal/monitor.h"
/** Size of the error buffer */
@ -454,12 +455,15 @@ bool modulecmd_register_command(const char *domain, const char *identifier,
const MODULECMD* modulecmd_find_command(const char *domain, const char *identifier)
{
reset_error();
const char* effective_domain = mxs_module_get_effective_name(domain);
MODULECMD *rval = NULL;
spinlock_acquire(&modulecmd_lock);
for (MODULECMD_DOMAIN *dm = modulecmd_domains; dm; dm = dm->next)
{
if (strcmp(domain, dm->domain) == 0)
if (strcmp(effective_domain, dm->domain) == 0)
{
for (MODULECMD *cmd = dm->commands; cmd; cmd = cmd->next)
{