From c48c4c7950e6b23479004586bf067c222ad77752 Mon Sep 17 00:00:00 2001 From: Johan Wikman Date: Thu, 28 Dec 2017 11:47:18 +0200 Subject: [PATCH] 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. --- server/core/modulecmd.cc | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/server/core/modulecmd.cc b/server/core/modulecmd.cc index 2688e612f..25e78d097 100644 --- a/server/core/modulecmd.cc +++ b/server/core/modulecmd.cc @@ -22,6 +22,7 @@ #include #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) {