mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-04-23 19:10:37 +02:00
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>
This commit is contained in:
parent
7d924d725a
commit
92d8286660
2 changed files with 10 additions and 10 deletions
|
|
@ -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)",
|
||||
|
|
|
|||
|
|
@ -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 ();
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue