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
144
Issues
144
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
fa362167
Commit
fa362167
authored
Sep 12, 2013
by
Jiří Klimeš
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
cli: consolidate a code for connectivity check a bit
parent
449a0933
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
18 deletions
+8
-18
cli/src/network-manager.c
cli/src/network-manager.c
+8
-18
No files found.
cli/src/network-manager.c
View file @
fa362167
...
...
@@ -14,7 +14,7 @@
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*
* (C) Copyright 2010 - 201
2
Red Hat, Inc.
* (C) Copyright 2010 - 201
3
Red Hat, Inc.
*/
#include "config.h"
...
...
@@ -535,7 +535,7 @@ nmc_switch_show (NmCli *nmc, const char *switch_name, const char *header)
g_return_val_if_fail
(
switch_name
!=
NULL
,
FALSE
);
if
(
nmc
->
required_fields
&&
strcasecmp
(
nmc
->
required_fields
,
switch_name
)
!=
0
)
{
g_string_printf
(
nmc
->
return_text
,
_
(
"Error: '--fields' value '%s' is not valid here (allowed field
s
: %s)"
),
g_string_printf
(
nmc
->
return_text
,
_
(
"Error: '--fields' value '%s' is not valid here (allowed field: %s)"
),
nmc
->
required_fields
,
switch_name
);
nmc
->
return_value
=
NMC_RESULT_ERROR_USER_INPUT
;
return
FALSE
;
...
...
@@ -543,8 +543,9 @@ nmc_switch_show (NmCli *nmc, const char *switch_name, const char *header)
if
(
nmc
->
print_output
==
NMC_PRINT_NORMAL
)
nmc
->
print_output
=
NMC_PRINT_TERSE
;
nmc
->
required_fields
=
g_strdup
(
switch_name
);
return
show_nm_status
(
nmc
,
header
,
NMC_FIELDS_NM_STATUS_SWITCH
);
if
(
!
nmc
->
required_fields
)
nmc
->
required_fields
=
g_strdup
(
switch_name
);
return
show_nm_status
(
nmc
,
header
,
NULL
);
}
static
gboolean
...
...
@@ -570,19 +571,7 @@ nmc_switch_parse_on_off (NmCli *nmc, const char *arg1, const char *arg2, gboolea
static
gboolean
show_networking_connectivity
(
NmCli
*
nmc
)
{
g_return_val_if_fail
(
nmc
!=
NULL
,
FALSE
);
if
(
nmc
->
required_fields
&&
strcasecmp
(
nmc
->
required_fields
,
NMC_FIELDS_NM_CONNECTIVITY
)
!=
0
)
{
g_string_printf
(
nmc
->
return_text
,
_
(
"Error: '--fields' value '%s' is not valid here (allowed fields: %s)"
),
nmc
->
required_fields
,
NMC_FIELDS_NM_CONNECTIVITY
);
nmc
->
return_value
=
NMC_RESULT_ERROR_USER_INPUT
;
return
FALSE
;
}
if
(
nmc
->
print_output
==
NMC_PRINT_NORMAL
)
nmc
->
print_output
=
NMC_PRINT_TERSE
;
nmc
->
required_fields
=
g_strdup
(
NMC_FIELDS_NM_CONNECTIVITY
);
return
show_nm_status
(
nmc
,
_
(
"Connectivity"
),
NMC_FIELDS_NM_STATUS_SWITCH
);
return
nmc_switch_show
(
nmc
,
NMC_FIELDS_NM_CONNECTIVITY
,
_
(
"Connectivity"
));
}
/*
...
...
@@ -609,7 +598,8 @@ do_networking (NmCli *nmc, int argc, char **argv)
nm_client_check_connectivity
(
nmc
->
client
,
NULL
,
&
error
);
if
(
error
)
{
g_string_printf
(
nmc
->
return_text
,
_
(
"Error: %s."
),
error
->
message
);
nmc
->
return_value
=
NMC_RESULT_ERROR_USER_INPUT
;
nmc
->
return_value
=
NMC_RESULT_ERROR_UNKNOWN
;
g_clear_error
(
&
error
);
}
else
show_networking_connectivity
(
nmc
);
}
else
{
...
...
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