diff options
| author | Thomas Haller <thaller@redhat.com> | 2019-05-29 15:48:22 +0200 |
|---|---|---|
| committer | Beniamino Galvani <bgalvani@redhat.com> | 2019-06-04 15:46:21 +0200 |
| commit | 56f45d7ba373ee29e51efe24f5a541046358d531 (patch) | |
| tree | 66899cae2a7c6e371c0297a4ba2c1b4f0c71620a | |
| parent | f4222aff0720d27264cf2d473543541f7564b050 (diff) | |
| download | NetworkManager-56f45d7ba373ee29e51efe24f5a541046358d531.tar.gz | |
libnm/team: add space in JSON output for link watcher
Generate the following:
{ "runner": { "sys_prio": 10 }, "link_watch": { "name": "ethtool" } }
instead of:
{ "runner": { "sys_prio": 10 }, "link_watch": { "name": "ethtool"} }
| -rw-r--r-- | libnm-core/nm-team-utils.c | 2 | ||||
| -rw-r--r-- | libnm-core/tests/test-setting.c | 6 |
2 files changed, 4 insertions, 4 deletions
diff --git a/libnm-core/nm-team-utils.c b/libnm-core/nm-team-utils.c index 814fd5369a..45738e5d14 100644 --- a/libnm-core/nm-team-utils.c +++ b/libnm-core/nm-team-utils.c @@ -1030,7 +1030,7 @@ _link_watcher_to_json (const NMTeamLinkWatcher *link_watcher, nm_value_type_to_json (attr_data->value_type, gstr, &p_val->val); } - g_string_append (gstr, "}"); + g_string_append (gstr, " }"); } #if WITH_JSON_VALIDATION diff --git a/libnm-core/tests/test-setting.c b/libnm-core/tests/test-setting.c index a3be0bc8fa..1d4b1b1d61 100644 --- a/libnm-core/tests/test-setting.c +++ b/libnm-core/tests/test-setting.c @@ -1469,7 +1469,7 @@ test_team_setting (void) _check_team_setting (setting); g_assert_cmpint (nm_setting_team_get_num_link_watchers (NM_SETTING_TEAM (setting)), ==, 1); - g_assert_cmpstr (nm_setting_team_get_config (NM_SETTING_TEAM (setting)), ==, "{ \"runner\": { \"sys_prio\": 10 }, \"link_watch\": { \"name\": \"ethtool\"} }"); + g_assert_cmpstr (nm_setting_team_get_config (NM_SETTING_TEAM (setting)), ==, "{ \"runner\": { \"sys_prio\": 10 }, \"link_watch\": { \"name\": \"ethtool\" } }"); nm_setting_team_remove_link_watcher (NM_SETTING_TEAM (setting), 0); @@ -1479,11 +1479,11 @@ test_team_setting (void) nm_setting_team_add_link_watcher (NM_SETTING_TEAM (setting), watcher1); _check_team_setting (setting); - g_assert_cmpstr (nm_setting_team_get_config (NM_SETTING_TEAM (setting)), ==, "{ \"runner\": { \"sys_prio\": 10 }, \"link_watch\": { \"name\": \"nsna_ping\", \"target_host\": \"bbb\", \"init_wait\": 1, \"interval\": 3, \"missed_max\": 4} }"); + g_assert_cmpstr (nm_setting_team_get_config (NM_SETTING_TEAM (setting)), ==, "{ \"runner\": { \"sys_prio\": 10 }, \"link_watch\": { \"name\": \"nsna_ping\", \"target_host\": \"bbb\", \"init_wait\": 1, \"interval\": 3, \"missed_max\": 4 } }"); nm_setting_team_add_link_watcher (NM_SETTING_TEAM (setting), watcher2); _check_team_setting (setting); - g_assert_cmpstr (nm_setting_team_get_config (NM_SETTING_TEAM (setting)), ==, "{ \"runner\": { \"sys_prio\": 10 }, \"link_watch\": [ { \"name\": \"nsna_ping\", \"target_host\": \"bbb\", \"init_wait\": 1, \"interval\": 3, \"missed_max\": 4}, { \"name\": \"arp_ping\", \"target_host\": \"ccc\", \"source_host\": \"ddd\", \"init_wait\": 1, \"interval\": 3, \"missed_max\": 4} ] }"); + g_assert_cmpstr (nm_setting_team_get_config (NM_SETTING_TEAM (setting)), ==, "{ \"runner\": { \"sys_prio\": 10 }, \"link_watch\": [ { \"name\": \"nsna_ping\", \"target_host\": \"bbb\", \"init_wait\": 1, \"interval\": 3, \"missed_max\": 4 }, { \"name\": \"arp_ping\", \"target_host\": \"ccc\", \"source_host\": \"ddd\", \"init_wait\": 1, \"interval\": 3, \"missed_max\": 4 } ] }"); nm_setting_team_remove_link_watcher (NM_SETTING_TEAM (setting), 0); nm_setting_team_remove_link_watcher (NM_SETTING_TEAM (setting), 0); |
