cli: hide ethtool options form nmcli connection show "$PROFILE" output

We will add a large number of offload features. That means, the output
of `nmcli connection show "$PROFILE"` would be very verbose, in case
the profile has a [ethtool] option.

Since this is newly added API, don't do that. Don't show ethtool properties
that are left unset.

A minor problem here is, that it becomes no longer obvious which
properties exist. We should however counter that by documentation.
Also, one could do:

  $ nmcli connection modify "$PROFILE" ethtool.xxx x
  Error: invalid property 'xxx': 'xxx' not among [feature-gro, feature-gso, feature-lro, feature-ntuple, feature-rx, feature-rxhash, feature-rxvlan, feature-sg, feature-tso, feature-tx, feature-txvlan, feature-tx-tcp6-segmentation, feature-tx-tcp-segmentation].

Likewise, bash completion still works as one would expect.

  $ nmcli --complete-args connection modify "$PROFILE" ethtool.
  ethtool.feature-gro
  ethtool.feature-gso
  ethtool.feature-lro
  [...]

Note the output of

  $ nmcli -f ethtool.feature-gro connection show "$PROFILE"

gives now nothing (if there is an ethtool section, but not this
particular feature). Maybe this shouldn't be like that. On the other
hand, specifying a connection setting that doesn't exist also gives
no output:

  $ nmcli -f bond connection show "$PROFILE"

So, maybe this behavior is fine.
This commit is contained in:
Thomas Haller 2018-08-08 20:48:25 +02:00
parent 582ee91145
commit 9e7c960fad

View file

@ -4842,6 +4842,7 @@ _get_fcn_ethtool (ARGS_GET_FCN)
else {
s = NULL;
NM_SET_OUT (out_is_default, TRUE);
*out_flags |= NM_META_ACCESSOR_GET_OUT_FLAGS_HIDE;
}
if (s && get_type == NM_META_ACCESSOR_GET_TYPE_PRETTY)