summaryrefslogtreecommitdiff
path: root/clients
diff options
context:
space:
mode:
authorJiří Klimeš <jklimes@redhat.com>2014-09-19 11:11:19 +0200
committerJiří Klimeš <jklimes@redhat.com>2014-09-22 12:53:46 +0200
commitf27a259ee625ba243f04832a9167b2928fcaf25e (patch)
tree9669241236582c8ce43035ef5f3695bc6c090252 /clients
parent82947737b1af0fe96b59fefcafc400668a0e9323 (diff)
downloadNetworkManager-f27a259ee625ba243f04832a9167b2928fcaf25e.tar.gz
cli: when NM is not running, give this error in 'nmcli connection'
Check whether NM is running before comparing nmcli and NM versions. Returning NMC_RESULT_ERROR_NM_NOT_RUNNING is in accordance with other nmcli commands.
Diffstat (limited to 'clients')
-rw-r--r--clients/cli/connections.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/clients/cli/connections.c b/clients/cli/connections.c
index bd425ecfd6..1396b2356c 100644
--- a/clients/cli/connections.c
+++ b/clients/cli/connections.c
@@ -8429,13 +8429,20 @@ do_connections (NmCli *nmc, int argc, char **argv)
return nmc->return_value;
}
+ /* Get NMClient object early */
+ nmc->get_client (nmc);
+
+ /* Check whether NetworkManager is runnung */
+ if (!nm_client_get_nm_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;
+ }
+
/* Compare NM and nmcli versions */
if (!nmc_versions_match (nmc))
return nmc->return_value;
- /* Get NMClient object early */
- nmc->get_client (nmc);
-
/* Get NMRemoteSettings object */
if (!(nmc->system_settings = nm_remote_settings_new (NULL, &error))) {
g_string_printf (nmc->return_text, _("Error: Could not get system settings: %s."), error->message);