MXS-1999: Fix removal of undefined relationships

If a relationship isn't defined, it should not be removed. Only if a
relationship is change to a null relationship, should it be removed.

Also fixed the maxctrl test suite to verify that both it and the REST API
tests pass.
This commit is contained in:
Markus Mäkelä
2018-08-06 17:27:17 +03:00
parent 4fd4d6bb01
commit 446116a8bb
5 changed files with 51 additions and 4 deletions

View File

@ -1385,7 +1385,8 @@ SERVER* runtime_create_server_from_json(json_t* json)
bool server_to_object_relations(SERVER* server, json_t* old_json, json_t* new_json)
{
if (mxs_json_pointer(new_json, MXS_JSON_PTR_RELATIONSHIPS) == NULL)
if (mxs_json_pointer(new_json, MXS_JSON_PTR_RELATIONSHIPS_SERVICES) == NULL &&
mxs_json_pointer(new_json, MXS_JSON_PTR_RELATIONSHIPS_MONITORS) == NULL)
{
/** No change to relationships */
return true;
@ -1633,7 +1634,7 @@ MXS_MONITOR* runtime_create_monitor_from_json(json_t* json)
bool object_to_server_relations(const char* target, json_t* old_json, json_t* new_json)
{
if (mxs_json_pointer(new_json, MXS_JSON_PTR_RELATIONSHIPS) == NULL)
if (mxs_json_pointer(new_json, MXS_JSON_PTR_RELATIONSHIPS_SERVERS) == NULL)
{
/** No change to relationships */
return true;