From e0252e7a75c66b3d5e5d209e087ff3a0aee788db Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Wed, 1 Mar 2017 14:07:12 +0100 Subject: ifcfg-rh: require connections to be fully normalized for writing --- src/settings/plugins/ifcfg-rh/nms-ifcfg-rh-writer.c | 2 +- src/settings/plugins/ifcfg-rh/tests/test-ifcfg-rh.c | 7 +++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/settings/plugins/ifcfg-rh/nms-ifcfg-rh-writer.c b/src/settings/plugins/ifcfg-rh/nms-ifcfg-rh-writer.c index 4e025c245..620e89e4b 100644 --- a/src/settings/plugins/ifcfg-rh/nms-ifcfg-rh-writer.c +++ b/src/settings/plugins/ifcfg-rh/nms-ifcfg-rh-writer.c @@ -2726,7 +2726,7 @@ write_connection (NMConnection *connection, gboolean wired = FALSE; nm_assert (NM_IS_CONNECTION (connection)); - nm_assert (nm_connection_verify (connection, NULL)); + nm_assert (_nm_connection_verify (connection, NULL) == NM_SETTING_VERIFY_SUCCESS); nm_assert (!out_reread || !*out_reread); if (!writer_can_write_connection (connection, error)) diff --git a/src/settings/plugins/ifcfg-rh/tests/test-ifcfg-rh.c b/src/settings/plugins/ifcfg-rh/tests/test-ifcfg-rh.c index 824fa1aca..bc021ed14 100644 --- a/src/settings/plugins/ifcfg-rh/tests/test-ifcfg-rh.c +++ b/src/settings/plugins/ifcfg-rh/tests/test-ifcfg-rh.c @@ -115,7 +115,7 @@ _assert_reread_same_FIXME (NMConnection *connection, NMConnection *reread) #define _writer_update_connection_reread(connection, ifcfg_dir, filename, out_reread, out_reread_same) \ G_STMT_START { \ - NMConnection *_connection = (connection); \ + gs_unref_object NMConnection *_connection = nmtst_connection_duplicate_and_normalize (connection); \ NMConnection **_out_reread = (out_reread); \ gboolean *_out_reread_same = (out_reread_same); \ const char *_ifcfg_dir = (ifcfg_dir); \ @@ -266,6 +266,7 @@ _writer_new_connection_fail (NMConnection *connection, const char *ifcfg_dir, GError **error) { + gs_unref_object NMConnection *connection_normalized = NULL; gs_unref_object NMConnection *reread = NULL; gboolean success; GError *local = NULL; @@ -274,7 +275,9 @@ _writer_new_connection_fail (NMConnection *connection, g_assert (NM_IS_CONNECTION (connection)); g_assert (ifcfg_dir); - success = writer_new_connection (connection, + connection_normalized = nmtst_connection_duplicate_and_normalize (connection); + + success = writer_new_connection (connection_normalized, ifcfg_dir, &filename, &reread, -- cgit v1.2.3