Connection errors should be reflected by non-zero exit codes

Migrated from https://bugs.x2go.org/cgi-bin/bugreport.cgi?bug=1507

If the remote user does not exist, then pyhoca-cli exits with success (exit code 0). The calling script does not know then that the connection has failed.

For scripting purposes, it is important that errors are always signalled with a non-zero exit code.

Example:

$ pyhoca-cli --server localhost --username=does-not-exist

pyhoca-cli[97275] NOTICE: preparing requested X2Go session pyhoca-cli[97275] (PyHocaCLI) NOTICE: preparing requested X2Go session pyhoca-cli[97275] (x2gosessregistry-pylib) NOTICE: registering X2Go session Pyhoca-Client_Session... pyhoca-cli[97275] (x2goclient-pylib) NOTICE: initializing X2Go session... pyhoca-cli[97275] (x2gocontrolsession-pylib) NOTICE: connecting to [localhost]:22 pyhoca-cli[97275] (PyHocaCLI) WARN: passwordless login for ,,does-not-exist'' failed [SSHException] pyhoca-cli: error: No existing session

$ echo "Exit status code: $?" Exit status code: 0

Edited by Mike Gabriel