Skip to content

[th/cli-fix-con-show-active-field] cli: fix showing active state for `nmcli con show` with fields

Thomas Haller requested to merge th/cli-fix-con-show-active-field into master

With "connection.multi-connect", a profile can be activated multiple times on a device with nmcli connection show.

If the user requests no fields that are part of the activation state, then the active connections are ignored. For example with nmcli -f UUID,NAME connection show. In that case, lines cannot be duplicated.

On the other hand, with nmcli -g UUID,NAME,DEVICE connection show the user again requested also to see the activation state, and duplicate lines can appear.

To handle that, we need to consider which fields were requested.

There was a bug where the "ACTIVE" field was not treated as part of the activation state. That results in nmcli -f UUID,NAME,ACTIVE connection show always returning "no". Fix that.

Fixes: a1b25a47 ('cli: rework printing of nmcli connection for multiple active connections')

--

Fixes: #547 (closed)

Merge request reports