diff options
author | Thomas Haller <thaller@redhat.com> | 2014-07-03 14:12:58 +0200 |
---|---|---|
committer | Thomas Haller <thaller@redhat.com> | 2014-08-22 15:24:30 +0200 |
commit | 92d82866602067ece1f55e245c0f7061375f9888 (patch) | |
tree | 200d0c75213abef5d8fadb86d553350bd97ec9d1 | |
parent | 7d924d725a70622dffe023fa8dcb96d16fcdafd1 (diff) | |
download | NetworkManager-92d82866602067ece1f55e245c0f7061375f9888.tar.gz |
keyfile: let reader normalize() the connection, not only verify()
The new nm_connection_normalize() function allows to fixup an incomplete connection.
The keyfile reader should call normalize on a connection, so that we can implement
common normalizations there instead of inside the settings plugin.
Signed-off-by: Thomas Haller <thaller@redhat.com>
-rw-r--r-- | src/settings/plugins/keyfile/reader.c | 4 | ||||
-rw-r--r-- | src/settings/plugins/keyfile/tests/test-keyfile.c | 16 |
2 files changed, 10 insertions, 10 deletions
diff --git a/src/settings/plugins/keyfile/reader.c b/src/settings/plugins/keyfile/reader.c index f2a2d473a9..565ce3474e 100644 --- a/src/settings/plugins/keyfile/reader.c +++ b/src/settings/plugins/keyfile/reader.c @@ -1332,8 +1332,8 @@ nm_keyfile_plugin_connection_from_file (const char *filename, GError **error) g_strfreev (groups); - /* Verify the connection */ - if (!nm_connection_verify (connection, &verify_error)) { + /* Normalize and verify the connection */ + if (!nm_connection_normalize (connection, NULL, NULL, &verify_error)) { g_set_error (error, KEYFILE_PLUGIN_ERROR, 0, "invalid or missing connection property '%s/%s'", verify_error ? g_type_name (nm_setting_lookup_type_by_quark (verify_error->domain)) : "(unknown)", diff --git a/src/settings/plugins/keyfile/tests/test-keyfile.c b/src/settings/plugins/keyfile/tests/test-keyfile.c index ba763175ad..369085dd9a 100644 --- a/src/settings/plugins/keyfile/tests/test-keyfile.c +++ b/src/settings/plugins/keyfile/tests/test-keyfile.c @@ -1376,7 +1376,7 @@ test_write_string_ssid (void) reread = nm_keyfile_plugin_connection_from_file (testfile, NULL); ASSERT (reread != NULL, "connection-write", "failed to re-read test connection"); - nmtst_assert_connection_equals (connection, FALSE, reread, FALSE); + nmtst_assert_connection_equals (connection, TRUE, reread, FALSE); g_clear_error (&error); unlink (testfile); @@ -1500,7 +1500,7 @@ test_write_intlist_ssid (void) g_assert_no_error (error); g_assert (reread); - nmtst_assert_connection_equals (connection, FALSE, reread, FALSE); + nmtst_assert_connection_equals (connection, TRUE, reread, FALSE); g_clear_error (&error); unlink (testfile); @@ -1651,7 +1651,7 @@ test_write_intlike_ssid (void) g_assert_no_error (error); g_assert (reread); - nmtst_assert_connection_equals (connection, FALSE, reread, FALSE); + nmtst_assert_connection_equals (connection, TRUE, reread, FALSE); g_clear_error (&error); unlink (testfile); @@ -1738,7 +1738,7 @@ test_write_intlike_ssid_2 (void) g_assert_no_error (error); g_assert (reread); - nmtst_assert_connection_equals (connection, FALSE, reread, FALSE); + nmtst_assert_connection_equals (connection, TRUE, reread, FALSE); g_clear_error (&error); unlink (testfile); @@ -1992,7 +1992,7 @@ test_write_bt_dun_connection (void) reread = nm_keyfile_plugin_connection_from_file (testfile, NULL); ASSERT (reread != NULL, "connection-write", "failed to re-read test connection"); - nmtst_assert_connection_equals (connection, FALSE, reread, FALSE); + nmtst_assert_connection_equals (connection, TRUE, reread, FALSE); g_clear_error (&error); unlink (testfile); @@ -2225,7 +2225,7 @@ test_write_gsm_connection (void) reread = nm_keyfile_plugin_connection_from_file (testfile, NULL); ASSERT (reread != NULL, "connection-write", "failed to re-read test connection"); - nmtst_assert_connection_equals (connection, FALSE, reread, FALSE); + nmtst_assert_connection_equals (connection, TRUE, reread, FALSE); g_clear_error (&error); unlink (testfile); @@ -3218,7 +3218,7 @@ test_write_new_wired_group_name (void) reread = nm_keyfile_plugin_connection_from_file (testfile, &error); g_assert_no_error (error); g_assert (reread); - nmtst_assert_connection_equals (connection, FALSE, reread, FALSE); + nmtst_assert_connection_equals (connection, TRUE, reread, FALSE); /* Look at the keyfile itself to ensure we wrote out the new group names and type */ kf = g_key_file_new (); @@ -3348,7 +3348,7 @@ test_write_new_wireless_group_names (void) reread = nm_keyfile_plugin_connection_from_file (testfile, &error); g_assert_no_error (error); g_assert (reread); - nmtst_assert_connection_equals (connection, FALSE, reread, FALSE); + nmtst_assert_connection_equals (connection, TRUE, reread, FALSE); /* Look at the keyfile itself to ensure we wrote out the new group names and type */ kf = g_key_file_new (); |