nmcli returns success exit code (0) on Error: Connection activation failed
To reproduce:
nmcli dev wifi connect MySSID password 'INCORRECTPASSWORD'; echo "Exit code: $?"
Result:
Error: Connection activation failed: (7) Secrets were required, but not provided.
Exit code: 0
The same result is given regardless of whether the connection already exists or it is a brand new connection.
Reproduced on:
- Ubuntu 20.04.3 LTS (Focal Fossa); nmcli tool, version 1.22.10;
- Raspbian GNU/Linux 11 (bullseye); nmcli tool, version 1.30.0
It could also be argued that the error message is misleading, too. The actual reason for the error is an incorrect password as opposed to no password being provided.