summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Haller <thaller@redhat.com>2017-03-01 14:07:12 +0100
committerThomas Haller <thaller@redhat.com>2017-03-02 12:14:29 +0100
commite0252e7a75c66b3d5e5d209e087ff3a0aee788db (patch)
tree7e24791eb5cb8e87a662b1804336bfaab77f2f11
parentb4594af55e0665917c48f0dd3cd56b49f2ea1f78 (diff)
downloadNetworkManager-e0252e7a75c66b3d5e5d209e087ff3a0aee788db.tar.gz
ifcfg-rh: require connections to be fully normalized for writing
-rw-r--r--src/settings/plugins/ifcfg-rh/nms-ifcfg-rh-writer.c2
-rw-r--r--src/settings/plugins/ifcfg-rh/tests/test-ifcfg-rh.c7
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 4e025c2452..620e89e4ba 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 824fa1aca3..bc021ed14f 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,