From cc479f6b79f151cccca034194899939f49854bac Mon Sep 17 00:00:00 2001 From: Jose Gomez <1josegomezr@gmail.com> Date: Fri, 27 Oct 2023 21:59:06 +0200 Subject: [PATCH] Display the correct failing host on worker boot When a worker cannot establish a websocket connection the log line reports the URL of the REST API, and not the websocket endpoint where the connection failed. --- lib/OpenQA/Worker/WebUIConnection.pm | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lib/OpenQA/Worker/WebUIConnection.pm b/lib/OpenQA/Worker/WebUIConnection.pm index 137e14728b5..81687e9c5c1 100644 --- a/lib/OpenQA/Worker/WebUIConnection.pm +++ b/lib/OpenQA/Worker/WebUIConnection.pm @@ -157,6 +157,11 @@ sub _setup_websocket_connection ($self, $websocket_url = undef) { my $error = $tx->error; my $error_message = "Unable to upgrade to ws connection via $websocket_url"; + + if ($tx->res->error && $tx->res->error->{message}) { + $error_message .= sprintf(", %s in %s", $tx->res->error->{message}, $tx->req->url); + } + $error_message .= ", code $error->{code}" if ($error && $error->{code}); $self->_set_status(failed => {error_message => $error_message}); return undef;