From 832fa8c73d1351474c959ec3981eec0795ac8040 Mon Sep 17 00:00:00 2001 From: Graham Christensen Date: Mon, 10 Jan 2022 10:33:33 -0500 Subject: [PATCH 1/3] Controller/Jobset: make some warnings about undef's go away --- src/lib/Hydra/Controller/Jobset.pm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/lib/Hydra/Controller/Jobset.pm b/src/lib/Hydra/Controller/Jobset.pm index a5b6cfac..b952031f 100644 --- a/src/lib/Hydra/Controller/Jobset.pm +++ b/src/lib/Hydra/Controller/Jobset.pm @@ -239,7 +239,7 @@ sub updateJobset { error($c, "Cannot rename jobset to ‘$jobsetName’ since that identifier is already taken.") if $jobsetName ne $oldName && defined $c->stash->{project}->jobsets->find({ name => $jobsetName }); - my $type = int($c->stash->{params}->{"type"}) // 0; + my $type = int($c->stash->{params}->{"type"} // 0); my ($nixExprPath, $nixExprInput); my $flake; @@ -270,7 +270,7 @@ sub updateJobset { , enableemail => defined $c->stash->{params}->{enableemail} ? 1 : 0 , emailoverride => trim($c->stash->{params}->{emailoverride}) || "" , hidden => defined $c->stash->{params}->{visible} ? 0 : 1 - , keepnr => int(trim($c->stash->{params}->{keepnr})) + , keepnr => int(trim($c->stash->{params}->{keepnr} // "0")) , checkinterval => $checkinterval , triggertime => ($enabled && $checkinterval > 0) ? $jobset->triggertime // time() : undef , schedulingshares => $shares From 6b2f0a9fe1f1dbdd7ff70c636714ffcd7636fd70 Mon Sep 17 00:00:00 2001 From: Graham Christensen Date: Mon, 10 Jan 2022 10:38:48 -0500 Subject: [PATCH 2/3] api-test.t: set a default method --- t/api-test.t | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/t/api-test.t b/t/api-test.t index bd26d487..08d52dc1 100644 --- a/t/api-test.t +++ b/t/api-test.t @@ -42,7 +42,7 @@ sub request_json { $req->uri("http://localhost$opts->{uri}"); $req->header(Accept => "application/json"); $req->header(Content_Type => "application/json"); - $req->header(Origin => "http://localhost/") if $opts->{method} eq "POST"; + $req->header(Origin => "http://localhost/") if ($opts->{method} // "") eq "POST"; $req->header(Cookie => $cookie); $req->content(encode_json($opts->{data})) if defined $opts->{data}; From d8025fcf045d71184dfcc95bc3c4e8b35d3f6a92 Mon Sep 17 00:00:00 2001 From: Graham Christensen Date: Mon, 10 Jan 2022 10:39:22 -0500 Subject: [PATCH 3/3] api-test.t: don't print request content It adds noise to the logs --- t/api-test.t | 1 - 1 file changed, 1 deletion(-) diff --git a/t/api-test.t b/t/api-test.t index 08d52dc1..e89d4460 100644 --- a/t/api-test.t +++ b/t/api-test.t @@ -47,7 +47,6 @@ sub request_json { $req->content(encode_json($opts->{data})) if defined $opts->{data}; my $res = request($req); - print $res->as_string(); return $res; }