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

Handle case where jobset has no defined errormsg for api/jobsets #702

Merged
merged 2 commits into from Apr 1, 2020

Conversation

kquick
Copy link
Contributor

@kquick kquick commented Jan 12, 2020

Fixes logged messages:

{date} {hostname} hydra-server[PID]: Use of uninitialized value in string eq at /nix/store/.../libexec/hydra/lib/Hydra/Controller/API.pm line 79 <$read> line 383.

@@ -88,7 +88,7 @@ sub jobsetToHash {
triggertime => $jobset->triggertime,
fetcherrormsg => $jobset->fetcherrormsg,
errortime => $jobset->errortime,
haserrormsg => $jobset->errormsg eq "" ? JSON::false : JSON::true
haserrormsg => defined($jobset->errormsg) ? ($jobset->errormsg eq "" ? JSON::false : JSON::true) : JSON::false
Copy link
Member

Choose a reason for hiding this comment

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

I think it's clearer to collapse the nested condition into a single condition like:

Suggested change
haserrormsg => defined($jobset->errormsg) ? ($jobset->errormsg eq "" ? JSON::false : JSON::true) : JSON::false
haserrormsg => defined($jobset->errormsg) && $jobset->errormsg ne "" ? JSON::true : JSON::false

@nlewo
Copy link
Member

nlewo commented Jan 21, 2020

@kquick Could you squash these commits?
Otherwise, lgtm.

@kquick
Copy link
Contributor Author

kquick commented Jan 21, 2020

I'd prefer not to squash these commits, since I've already merged them into other branches and the result would be pretty impactful from an administrative perspective (... it would take a significant amount of effort to rebuild those other branches, which had other commits on them as well). OK, @nlewo?

@edolstra edolstra merged commit 2d092a6 into NixOS:master Apr 1, 2020
@kquick kquick deleted the fix_api_push branch April 1, 2020 17:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants