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.
This commit is contained in:
@@ -8429,13 +8429,20 @@ do_connections (NmCli *nmc, int argc, char **argv)
|
|||||||
return nmc->return_value;
|
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 */
|
/* Compare NM and nmcli versions */
|
||||||
if (!nmc_versions_match (nmc))
|
if (!nmc_versions_match (nmc))
|
||||||
return nmc->return_value;
|
return nmc->return_value;
|
||||||
|
|
||||||
/* Get NMClient object early */
|
|
||||||
nmc->get_client (nmc);
|
|
||||||
|
|
||||||
/* Get NMRemoteSettings object */
|
/* Get NMRemoteSettings object */
|
||||||
if (!(nmc->system_settings = nm_remote_settings_new (NULL, &error))) {
|
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);
|
g_string_printf (nmc->return_text, _("Error: Could not get system settings: %s."), error->message);
|
||||||
|
Reference in New Issue
Block a user