Fix refactoring errors
The monitor deletion would mistakenly label all monitors as not being created at runtime. Due to this, the deletion of monitors would fail.
This commit is contained in:
parent
05d185fc02
commit
d2543c4841
@ -884,20 +884,10 @@ bool runtime_destroy_monitor(MXS_MONITOR *monitor)
|
||||
|
||||
spinlock_acquire(&crt_lock);
|
||||
|
||||
if (unlink(filename) == -1)
|
||||
if (unlink(filename) == -1 && errno != ENOENT)
|
||||
{
|
||||
if (errno != ENOENT)
|
||||
{
|
||||
MXS_ERROR("Failed to remove persisted monitor configuration '%s': %d, %s",
|
||||
filename, errno, mxs_strerror(errno));
|
||||
}
|
||||
else
|
||||
{
|
||||
rval = false;
|
||||
MXS_WARNING("Monitor '%s' was not created at runtime. Remove the "
|
||||
"monitor manually from the correct configuration file.",
|
||||
monitor->name);
|
||||
}
|
||||
MXS_ERROR("Failed to remove persisted monitor configuration '%s': %d, %s",
|
||||
filename, errno, mxs_strerror(errno));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -332,6 +332,7 @@ HttpResponse cb_alter_logs(const HttpRequest& request)
|
||||
HttpResponse cb_delete_server(const HttpRequest& request)
|
||||
{
|
||||
SERVER* server = server_find_by_unique_name(request.uri_part(1).c_str());
|
||||
ss_dassert(server);
|
||||
|
||||
if (server && runtime_destroy_server(server))
|
||||
{
|
||||
@ -344,6 +345,7 @@ HttpResponse cb_delete_server(const HttpRequest& request)
|
||||
HttpResponse cb_delete_monitor(const HttpRequest& request)
|
||||
{
|
||||
MXS_MONITOR* monitor = monitor_find(request.uri_part(1).c_str());
|
||||
ss_dassert(monitor);
|
||||
|
||||
if (monitor && runtime_destroy_monitor(monitor))
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user