cockpit-project / cockpit

Cockpit is a web-based graphical interface for servers.
http://www.cockpit-project.org/
GNU Lesser General Public License v2.1
11.2k stars 1.11k forks source link

static: Handle no-cockpit error #21124

Closed martinpitt closed 2 weeks ago

martinpitt commented 2 weeks ago

When directly logging into a remote host without cockpit installed, the login page showed an unhelpful and untranslatable fatal error message:

Authentication failed: no-cockpit: [Errno 2] No such file or directory

This also left the user with nothing actionable other than reloading the page.

Handle the "no-cockpit" problem code and show a proper error message. Use the exact same one as in the shell's host switcher, to avoid introducing another similar translatable string. This also goes back to the login form, to either choose another host, or reattempt the login after installing cockpit on the target.


Spotted in #21121. In that PR we'll most probably refine that error message.

Screenshot on main:

login-no-cockpit-main

Screenshot with this PR -- I deliberately left it at German to see that it gets translated:

login-no-cockpit-pr

Note the "localhost" is a bit synthetic here due to how the test is set up -- ordinarily you'd choose a remote machine in the login form.

martinpitt commented 2 weeks ago

I was talking this over with Garrett. We'll discuss the specific design in https://github.com/cockpit-project/cockpit/pull/21121#discussion_r1803220498 , but also that whole #login-error alert needs some polishing (not just for this specific message). I'll land this (to avoid conflicts), work on that polishing next, and block #21121 on that.