Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Display the correct failing host on worker boot #5352

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions lib/OpenQA/Worker/WebUIConnection.pm
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,11 @@

my $error = $tx->error;
my $error_message = "Unable to upgrade to ws connection via $websocket_url";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would just alter the URL here:

Suggested change
my $error_message = "Unable to upgrade to ws connection via $websocket_url";
my $error_message = 'Unable to upgrade to ws connection via ' . $tx->req->url;

The original URL is still logged in the "Establishing …" line so there's nothing lost in my opinion.


if ($tx->res->error && $tx->res->error->{message}) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please use the post-if to be consistent with other lines

$error_message .= sprintf(", %s in %s", $tx->res->error->{message}, $tx->req->url);

Check warning on line 162 in lib/OpenQA/Worker/WebUIConnection.pm

View check run for this annotation

Codecov / codecov/patch

lib/OpenQA/Worker/WebUIConnection.pm#L161-L162

Added lines #L161 - L162 were not covered by tests
}

$error_message .= ", code $error->{code}" if ($error && $error->{code});
Comment on lines +161 to 165
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can just use $error for simplicity and there should always be a message:

Suggested change
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});
if ($error) {
$error_message .= ", $error->{message}";
$error_message .= ", code $error->{code}" if $error->{code};
}

I have also removed the URL because it is already part of the error message and I would just change that other part. However, if you disagree and want the original URL still being logged that's fine as well.

$self->_set_status(failed => {error_message => $error_message});
return undef;
Expand Down
Loading