Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
NetworkManager
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
147
Issues
147
List
Boards
Labels
Service Desk
Milestones
Merge Requests
12
Merge Requests
12
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
NetworkManager
NetworkManager
Commits
9a532db1
Commit
9a532db1
authored
Oct 31, 2013
by
Dan Winship
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
cli: add "nmcli con load file..."
https://bugzilla.gnome.org/show_bug.cgi?id=709830
parent
a52ebc74
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
57 additions
and
2 deletions
+57
-2
cli/src/connections.c
cli/src/connections.c
+50
-1
man/nmcli.1.in
man/nmcli.1.in
+7
-1
No files found.
cli/src/connections.c
View file @
9a532db1
...
...
@@ -227,7 +227,8 @@ usage (void)
" modify [ id | uuid | path ] <ID> <setting>.<property> <value>
\n\n
"
" edit [ id | uuid | path ] <ID> | [type <new_con_type>] [con-name <new_con_name>]
\n\n
"
" delete [ id | uuid | path ] <ID>
\n\n
"
" reload
\n\n\n
"
" reload
\n\n
"
" load <filename> [ <filename>... ]
\n\n\n
"
));
}
...
...
@@ -313,6 +314,7 @@ static const char *real_con_commands[] = {
"edit"
,
"delete"
,
"reload"
,
"load"
,
NULL
};
...
...
@@ -7262,6 +7264,50 @@ do_connection_reload (NmCli *nmc, int argc, char **argv)
return
nmc
->
return_value
;
}
static
NMCResultCode
do_connection_load
(
NmCli
*
nmc
,
int
argc
,
char
**
argv
)
{
GError
*
error
=
NULL
;
char
**
filenames
,
**
failures
=
NULL
;
int
i
;
nmc
->
return_value
=
NMC_RESULT_SUCCESS
;
nmc
->
should_wait
=
FALSE
;
if
(
!
nm_client_get_manager_running
(
nmc
->
client
))
{
g_string_printf
(
nmc
->
return_text
,
_
(
"Error: NetworkManager is not running."
));
nmc
->
return_value
=
NMC_RESULT_ERROR_NM_NOT_RUNNING
;
return
nmc
->
return_value
;
}
if
(
argc
==
0
)
{
g_string_printf
(
nmc
->
return_text
,
_
(
"Error: No connection specified."
));
nmc
->
return_value
=
NMC_RESULT_ERROR_USER_INPUT
;
return
nmc
->
return_value
;
}
filenames
=
g_new
(
char
*
,
argc
+
1
);
for
(
i
=
0
;
i
<
argc
;
i
++
)
filenames
[
i
]
=
argv
[
i
];
filenames
[
i
]
=
NULL
;
nm_remote_settings_load_connections
(
nmc
->
system_settings
,
filenames
,
&
failures
,
&
error
);
g_free
(
filenames
);
if
(
error
)
{
g_string_printf
(
nmc
->
return_text
,
_
(
"Error: %s."
),
error
->
message
);
nmc
->
return_value
=
NMC_RESULT_ERROR_UNKNOWN
;
g_error_free
(
error
);
}
if
(
failures
)
{
for
(
i
=
0
;
failures
[
i
];
i
++
)
fprintf
(
stderr
,
_
(
"Could not load file '%s'
\n
"
),
failures
[
i
]);
g_strfreev
(
failures
);
}
return
nmc
->
return_value
;
}
typedef
struct
{
NmCli
*
nmc
;
...
...
@@ -7347,6 +7393,9 @@ parse_cmd (NmCli *nmc, int argc, char **argv)
else
if
(
matches
(
*
argv
,
"reload"
)
==
0
)
{
nmc
->
return_value
=
do_connection_reload
(
nmc
,
argc
-
1
,
argv
+
1
);
}
else
if
(
matches
(
*
argv
,
"load"
)
==
0
)
{
nmc
->
return_value
=
do_connection_load
(
nmc
,
argc
-
1
,
argv
+
1
);
}
else
if
(
matches
(
*
argv
,
"modify"
)
==
0
)
{
nmc
->
return_value
=
do_connection_modify
(
nmc
,
argc
-
1
,
argv
+
1
);
}
...
...
man/nmcli.1.in
View file @
9a532db1
...
...
@@ -272,7 +272,7 @@ be saved as two connections which both apply to eth0, one for DHCP (called
connected to the DHCP-enabled network the user would run "nmcli con up default"
, and when connected to the static network the user would run "nmcli con up testing".
.TP
.SS \fICOMMAND\fP := { show | up | down | add | edit | modify | delete | reload }
.SS \fICOMMAND\fP := { show | up | down | add | edit | modify | delete | reload
| load
}
.sp
.RS
.TP
...
...
@@ -615,6 +615,12 @@ to tell \fINetworkManager\fP to re-read the connection profiles from disk when
a change was made to them. However, the auto-loading feature can be enabled and
then \fINetworkManager\fP will reload connection files any time they change
(monitor-connection-files=true in \fINetworkManager.conf\fP(5)).
.TP
.B load <filename> [<filename>...]
.br
Load/reload one or more connection files from disk. Use this after manually
editing a connection file to ensure that \fBNetworkManager\fP is aware
of its latest state.
.RE
.TP
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment