Mailing List Archive

[OSSTEST PATCH 02/16] share in jobdb: Move out-of-flight special case higher up
This avoids running the runvar computation loop outside flights.
This is good amongst other things because that loop prints warnings
about undef $flight and $job.

Signed-off-by: Ian Jackson <iwj@xenproject.org>
---
Osstest/JobDB/Executive.pm | 33 ++++++++++++++++++---------------
1 file changed, 18 insertions(+), 15 deletions(-)

diff --git a/Osstest/JobDB/Executive.pm b/Osstest/JobDB/Executive.pm
index 071f31f1..4fa42e5d 100644
--- a/Osstest/JobDB/Executive.pm
+++ b/Osstest/JobDB/Executive.pm
@@ -587,6 +587,18 @@ END
$constraintsq->fetchrow_array() or confess "$hostname ?";
};

+
+ if (!defined $flight) {
+ db_retry($dbh_tests,[], sub {
+ $insertq->execute($hostname, $ttaskid,
+ undef,undef,
+ undef,
+ undef,undef);
+ $checkconstraints->();
+ });
+ return;
+ }
+
my $ojvn = "$ho->{Ident}_lifecycle";

if (length $r{$ojvn}) {
@@ -660,26 +672,17 @@ END
}
}

- if (defined $flight) {
- $insertq->execute($hostname, $ttaskid,
- $flight, $job,
- ($mode eq 'selectprep')+0,
+ $insertq->execute($hostname, $ttaskid,
+ $flight, $job,
+ ($mode eq 'selectprep')+0,
# ^ DBD::Pg doesn't accept perl canonical false for bool!
# https://rt.cpan.org/Public/Bug/Display.html?id=133229
- $tident, $tstepno);
- } else {
- $insertq->execute($hostname, $ttaskid,
- undef,undef,
- undef,
- undef,undef);
- }
+ $tident, $tstepno);
$checkconstraints->();
});

- if (defined $flight) {
- push @lifecycle, $newsigil if length $newsigil;
- store_runvar($ojvn, "@lifecycle");
- }
+ push @lifecycle, $newsigil if length $newsigil;
+ store_runvar($ojvn, "@lifecycle");
}

sub current_stepno ($) { #method
--
2.20.1