MXS-1220: Fix minor bug in monitor creation

The JSON validation function wasn't using the JSON Pointer function for
all values.
This commit is contained in:
Markus Mäkelä
2017-05-04 19:34:21 +03:00
parent c1968aac2f
commit 18b52adaeb

View File

@ -720,6 +720,10 @@ bool runtime_create_monitor(const char *name, const char *module)
}
}
}
else
{
MXS_INFO("Can't create monitor, it already exists");
}
spinlock_release(&crt_lock);
return rval;
@ -1015,7 +1019,7 @@ static bool validate_monitor_json(json_t* json)
json_t* value;
if ((value = mxs_json_pointer(json, PTR_ID)) && json_is_string(value) &&
(value = json_object_get(json, PTR_MON_MODULE)) && json_is_string(value))
(value = mxs_json_pointer(json, PTR_MON_MODULE)) && json_is_string(value))
{
set<string> relations;
if (extract_relations(json, relations, object_relation_types, object_relation_is_valid))
@ -1085,6 +1089,10 @@ MXS_MONITOR* runtime_create_monitor_from_json(json_t* json)
}
}
}
else
{
MXS_INFO("Invalid request JSON: %s", mxs::json_dump(json).c_str());
}
return rval;
}