ifcfg-rh: split connection_from_file() / connection_from_file_test()
Rather than having the "real" users of connection_from_file() have to pass a dozen NULL arguments, add a separate connection_from_file_test() for use by test-ifcfg-rh. (Likewise, since no test cases care about ignore_error, remove that argument from connection_from_file_test().)
This commit is contained in:
@@ -117,18 +117,10 @@ nm_ifcfg_connection_new (NMConnection *source,
|
|||||||
if (source)
|
if (source)
|
||||||
tmp = g_object_ref (source);
|
tmp = g_object_ref (source);
|
||||||
else {
|
else {
|
||||||
char *keyfile = NULL, *routefile = NULL, *route6file = NULL;
|
tmp = connection_from_file (full_path,
|
||||||
|
|
||||||
tmp = connection_from_file (full_path, NULL, NULL,
|
|
||||||
&unhandled_spec,
|
&unhandled_spec,
|
||||||
&keyfile,
|
|
||||||
&routefile,
|
|
||||||
&route6file,
|
|
||||||
error,
|
error,
|
||||||
ignore_error);
|
ignore_error);
|
||||||
g_free (keyfile);
|
|
||||||
g_free (routefile);
|
|
||||||
g_free (route6file);
|
|
||||||
if (!tmp)
|
if (!tmp)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
@@ -267,10 +259,7 @@ commit_changes (NMSettingsConnection *connection,
|
|||||||
* it if it's really changed.
|
* it if it's really changed.
|
||||||
*/
|
*/
|
||||||
if (priv->path) {
|
if (priv->path) {
|
||||||
reread = connection_from_file (priv->path, NULL, NULL,
|
reread = connection_from_file (priv->path, NULL, NULL, NULL);
|
||||||
NULL, NULL, NULL, NULL,
|
|
||||||
&error, NULL);
|
|
||||||
g_clear_error (&error);
|
|
||||||
if (reread) {
|
if (reread) {
|
||||||
same = nm_connection_compare (NM_CONNECTION (connection),
|
same = nm_connection_compare (NM_CONNECTION (connection),
|
||||||
reread,
|
reread,
|
||||||
|
@@ -4624,16 +4624,16 @@ check_dns_search_domains (shvarFile *ifcfg, NMSetting *s_ip4, NMSetting *s_ip6)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
NMConnection *
|
static NMConnection *
|
||||||
connection_from_file (const char *filename,
|
connection_from_file_full (const char *filename,
|
||||||
const char *network_file, /* for unit tests only */
|
const char *network_file, /* for unit tests only */
|
||||||
const char *test_type, /* for unit tests only */
|
const char *test_type, /* for unit tests only */
|
||||||
char **out_unhandled,
|
char **out_unhandled,
|
||||||
char **out_keyfile,
|
char **out_keyfile,
|
||||||
char **out_routefile,
|
char **out_routefile,
|
||||||
char **out_route6file,
|
char **out_route6file,
|
||||||
GError **error,
|
GError **error,
|
||||||
gboolean *out_ignore_error)
|
gboolean *out_ignore_error)
|
||||||
{
|
{
|
||||||
NMConnection *connection = NULL;
|
NMConnection *connection = NULL;
|
||||||
shvarFile *parsed;
|
shvarFile *parsed;
|
||||||
@@ -4839,3 +4839,37 @@ done:
|
|||||||
return connection;
|
return connection;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
NMConnection *
|
||||||
|
connection_from_file (const char *filename,
|
||||||
|
char **out_unhandled,
|
||||||
|
GError **error,
|
||||||
|
gboolean *out_ignore_error)
|
||||||
|
{
|
||||||
|
return connection_from_file_full (filename, NULL, NULL,
|
||||||
|
out_unhandled,
|
||||||
|
NULL, NULL, NULL,
|
||||||
|
error,
|
||||||
|
out_ignore_error);
|
||||||
|
}
|
||||||
|
|
||||||
|
NMConnection *
|
||||||
|
connection_from_file_test (const char *filename,
|
||||||
|
const char *network_file,
|
||||||
|
const char *test_type,
|
||||||
|
char **out_unhandled,
|
||||||
|
char **out_keyfile,
|
||||||
|
char **out_routefile,
|
||||||
|
char **out_route6file,
|
||||||
|
GError **error)
|
||||||
|
{
|
||||||
|
return connection_from_file_full (filename,
|
||||||
|
network_file,
|
||||||
|
test_type,
|
||||||
|
out_unhandled,
|
||||||
|
out_keyfile,
|
||||||
|
out_routefile,
|
||||||
|
out_route6file,
|
||||||
|
error,
|
||||||
|
NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
@@ -27,15 +27,20 @@
|
|||||||
#include "shvar.h"
|
#include "shvar.h"
|
||||||
|
|
||||||
NMConnection *connection_from_file (const char *filename,
|
NMConnection *connection_from_file (const char *filename,
|
||||||
const char *network_file, /* for unit tests only */
|
|
||||||
const char *test_type, /* for unit tests only */
|
|
||||||
char **out_unhandled,
|
char **out_unhandled,
|
||||||
char **out_keyfile,
|
|
||||||
char **out_routefile,
|
|
||||||
char **out_route6file,
|
|
||||||
GError **error,
|
GError **error,
|
||||||
gboolean *out_ignore_error);
|
gboolean *out_ignore_error);
|
||||||
|
|
||||||
char *uuid_from_file (const char *filename);
|
char *uuid_from_file (const char *filename);
|
||||||
|
|
||||||
|
/* for test-ifcfg-rh */
|
||||||
|
NMConnection *connection_from_file_test (const char *filename,
|
||||||
|
const char *network_file,
|
||||||
|
const char *test_type,
|
||||||
|
char **out_unhandled,
|
||||||
|
char **out_keyfile,
|
||||||
|
char **out_routefile,
|
||||||
|
char **out_route6file,
|
||||||
|
GError **error);
|
||||||
|
|
||||||
#endif /* __READER_H__ */
|
#endif /* __READER_H__ */
|
||||||
|
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user