mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-05-04 22:18:13 +02:00
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().)
(cherry picked from commit 356849f70c)
This commit is contained in:
parent
06b9ae9a5d
commit
03e1227277
4 changed files with 923 additions and 1079 deletions
|
|
@ -117,18 +117,10 @@ nm_ifcfg_connection_new (NMConnection *source,
|
|||
if (source)
|
||||
tmp = g_object_ref (source);
|
||||
else {
|
||||
char *keyfile = NULL, *routefile = NULL, *route6file = NULL;
|
||||
|
||||
tmp = connection_from_file (full_path, NULL, NULL,
|
||||
tmp = connection_from_file (full_path,
|
||||
&unhandled_spec,
|
||||
&keyfile,
|
||||
&routefile,
|
||||
&route6file,
|
||||
error,
|
||||
ignore_error);
|
||||
g_free (keyfile);
|
||||
g_free (routefile);
|
||||
g_free (route6file);
|
||||
if (!tmp)
|
||||
return NULL;
|
||||
|
||||
|
|
@ -267,10 +259,7 @@ commit_changes (NMSettingsConnection *connection,
|
|||
* it if it's really changed.
|
||||
*/
|
||||
if (priv->path) {
|
||||
reread = connection_from_file (priv->path, NULL, NULL,
|
||||
NULL, NULL, NULL, NULL,
|
||||
&error, NULL);
|
||||
g_clear_error (&error);
|
||||
reread = connection_from_file (priv->path, NULL, NULL, NULL);
|
||||
if (reread) {
|
||||
same = nm_connection_compare (NM_CONNECTION (connection),
|
||||
reread,
|
||||
|
|
|
|||
|
|
@ -4628,16 +4628,16 @@ check_dns_search_domains (shvarFile *ifcfg, NMSetting *s_ip4, NMSetting *s_ip6)
|
|||
}
|
||||
}
|
||||
|
||||
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_keyfile,
|
||||
char **out_routefile,
|
||||
char **out_route6file,
|
||||
GError **error,
|
||||
gboolean *out_ignore_error)
|
||||
static NMConnection *
|
||||
connection_from_file_full (const char *filename,
|
||||
const char *network_file, /* for unit tests only */
|
||||
const char *test_type, /* for unit tests only */
|
||||
char **out_unhandled,
|
||||
char **out_keyfile,
|
||||
char **out_routefile,
|
||||
char **out_route6file,
|
||||
GError **error,
|
||||
gboolean *out_ignore_error)
|
||||
{
|
||||
NMConnection *connection = NULL;
|
||||
shvarFile *parsed;
|
||||
|
|
@ -4843,3 +4843,37 @@ done:
|
|||
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"
|
||||
|
||||
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_keyfile,
|
||||
char **out_routefile,
|
||||
char **out_route6file,
|
||||
GError **error,
|
||||
gboolean *out_ignore_error);
|
||||
|
||||
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__ */
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
Loading…
Add table
Reference in a new issue