nmcli: fix an error message when the tc qdisc kind is missing

Before:

  # nmcli c modify eth666 tc.qdiscs root
  Error: failed to modify tc.qdiscs: '(null)' is not a valid kind The valid syntax is: '[root | parent <handle>] [handle <handle>] <qdisc>'.

After:

  # nmcli c modify eth666 tc.qdiscs root
  Error: failed to modify tc.qdiscs: kind is missing. The valid syntax is: '[root | parent <handle>] [handle <handle>] <kind>'.
This commit is contained in:
Lubomir Rintel
2019-04-09 08:14:25 +02:00
parent 549112c1ba
commit 817b55cf06
2 changed files with 32 additions and 8 deletions

View File

@@ -3580,9 +3580,9 @@ _objlist_set_fcn_tc_config_qdiscs (NMSetting *setting,
tc_qdisc = nm_utils_tc_qdisc_from_str (value, &local);
if (!tc_qdisc) {
nm_utils_error_set (error, NM_UTILS_ERROR_INVALID_ARGUMENT,
"%s %s",
"%s. %s",
local->message,
_("The valid syntax is: '[root | parent <handle>] [handle <handle>] <qdisc>'"));
_("The valid syntax is: '[root | parent <handle>] [handle <handle>] <kind>'"));
return FALSE;
}
if (do_add)
@@ -3604,7 +3604,7 @@ _objlist_set_fcn_bridge_vlans (NMSetting *setting,
vlan = nm_bridge_vlan_from_str (value, &local);
if (!vlan) {
nm_utils_error_set (error, NM_UTILS_ERROR_INVALID_ARGUMENT,
"%s %s",
"%s. %s",
local->message,
_("The valid syntax is: '<vid> [pvid] [untagged]"));
return FALSE;
@@ -3656,9 +3656,9 @@ _objlist_set_fcn_tc_config_tfilters (NMSetting *setting,
tc_tfilter = nm_utils_tc_tfilter_from_str (value, &local);
if (!tc_tfilter) {
nm_utils_error_set (error, NM_UTILS_ERROR_INVALID_ARGUMENT,
"%s %s",
"%s. %s",
local->message,
_("The valid syntax is: '[root | parent <handle>] [handle <handle>] <tfilter>'"));
_("The valid syntax is: '[root | parent <handle>] [handle <handle>] <kind>'"));
return FALSE;
}
if (do_add)

View File

@@ -62,7 +62,15 @@ nm_tc_qdisc_new (const char *kind,
{
NMTCQdisc *qdisc;
if (!kind || !*kind || strchr (kind, ' ') || strchr (kind, '\t')) {
if (!kind || !*kind) {
g_set_error (error,
NM_CONNECTION_ERROR,
NM_CONNECTION_ERROR_INVALID_PROPERTY,
_("kind is missing"));
return NULL;
}
if (strchr (kind, ' ') || strchr (kind, '\t')) {
g_set_error (error,
NM_CONNECTION_ERROR,
NM_CONNECTION_ERROR_INVALID_PROPERTY,
@@ -290,7 +298,15 @@ nm_tc_action_new (const char *kind,
{
NMTCAction *action;
if (!kind || !*kind || strchr (kind, ' ') || strchr (kind, '\t')) {
if (!kind || !*kind) {
g_set_error (error,
NM_CONNECTION_ERROR,
NM_CONNECTION_ERROR_INVALID_PROPERTY,
_("kind is missing"));
return NULL;
}
if (strchr (kind, ' ') || strchr (kind, '\t')) {
g_set_error (error,
NM_CONNECTION_ERROR,
NM_CONNECTION_ERROR_INVALID_PROPERTY,
@@ -544,7 +560,15 @@ nm_tc_tfilter_new (const char *kind,
{
NMTCTfilter *tfilter;
if (!kind || !*kind || strchr (kind, ' ') || strchr (kind, '\t')) {
if (!kind || !*kind) {
g_set_error (error,
NM_CONNECTION_ERROR,
NM_CONNECTION_ERROR_INVALID_PROPERTY,
_("kind is missing"));
return NULL;
}
if (strchr (kind, ' ') || strchr (kind, '\t')) {
g_set_error (error,
NM_CONNECTION_ERROR,
NM_CONNECTION_ERROR_INVALID_PROPERTY,