Commit 00e1e20b authored by Thomas Haller's avatar Thomas Haller

nmcli: special error message for access denied when SetLogging fails

Setting the logging level fails for normal users due to missing dbus
permissions as configured in src/org.freedesktop.NetworkManager.conf.

In that case, nmcli simply fails showing the dbus error. This error
is however not very clear, so this commit shows a different error
text for the particular case of ACCESS_DENIED.
Signed-off-by: Thomas Haller's avatarThomas Haller <thaller@redhat.com>
parent 5094d00b
......@@ -502,7 +502,10 @@ do_general (NmCli *nmc, int argc, char **argv)
nmc->get_client (nmc); /* create NMClient */
nm_client_set_logging (nmc->client, level, domains, &error);
if (error) {
g_string_printf (nmc->return_text, _("Error: %s."), error->message);
if (g_error_matches (error, DBUS_GERROR, DBUS_GERROR_ACCESS_DENIED))
g_string_printf (nmc->return_text, _("Error: access denied to set logging; %s"), error->message);
else
g_string_printf (nmc->return_text, _("Error: %s"), error->message);
nmc->return_value = NMC_RESULT_ERROR_USER_INPUT;
goto finish;
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment