libnm: disable g_warning() from library

Printing a g_warning() from the library is not helpful.

Client-side, libnm should support newer server versions and changing
formats. To support forward-compatibility, it should parse the received
GVariant best-effort like, without complaining.

Server-side, libnm-core should return errors when receiving invalid
configuration. It must not maintain forward-compatibility, only
backward-compatibility -- which is implemented by handling old
and newer formats. But never should server allow a configuration
that is invalid.

Currently, the libnm API cannot yet fail at this point. Hence,
it cannot return an error. It would need a strict and relaxed
parsing mode. Until that exists, just comment out the warnings.

(cherry picked from commit 7cd2b6178d)
This commit is contained in:
Thomas Haller 2017-12-08 17:12:46 +01:00 committed by Lubomir Rintel
parent 0e7a179910
commit 7257c5ec83

View file

@ -1262,13 +1262,13 @@ _qdiscs_from_variant (GVariant *value)
if ( !g_variant_lookup (qdisc_var, "kind", "&s", &kind)
|| !g_variant_lookup (qdisc_var, "parent", "u", &parent)) {
g_warning ("Ignoring invalid qdisc");
//g_warning ("Ignoring invalid qdisc");
goto next;
}
qdisc = nm_tc_qdisc_new (kind, parent, &error);
if (!qdisc) {
g_warning ("Ignoring invalid qdisc: %s", error->message);
//g_warning ("Ignoring invalid qdisc: %s", error->message);
g_clear_error (&error);
goto next;
}
@ -1417,13 +1417,13 @@ _tfilters_from_variant (GVariant *value)
if ( !g_variant_lookup (tfilter_var, "kind", "&s", &kind)
|| !g_variant_lookup (tfilter_var, "parent", "u", &parent)) {
g_warning ("Ignoring invalid tfilter");
//g_warning ("Ignoring invalid tfilter");
goto next;
}
tfilter = nm_tc_tfilter_new (kind, parent, &error);
if (!tfilter) {
g_warning ("Ignoring invalid tfilter: %s", error->message);
//g_warning ("Ignoring invalid tfilter: %s", error->message);
g_clear_error (&error);
goto next;
}
@ -1436,13 +1436,13 @@ _tfilters_from_variant (GVariant *value)
if (action_var) {
if (!g_variant_lookup (action_var, "kind", "&s", &action_kind)) {
g_warning ("Ignoring tfilter with invalid action");
//g_warning ("Ignoring tfilter with invalid action");
goto next;
}
action = nm_tc_action_new (action_kind, &error);
if (!action) {
g_warning ("Ignoring tfilter with invalid action: %s", error->message);
//g_warning ("Ignoring tfilter with invalid action: %s", error->message);
g_clear_error (&error);
goto next;
}