diff mbox

[OSSTEST,13/17] step logfiles: Honour new logfile column

Message ID 1498839920-17025-14-git-send-email-ian.jackson@eu.citrix.com (mailing list archive)
State New, archived
Headers show

Commit Message

Ian Jackson June 30, 2017, 4:25 p.m. UTC
There are the following places in the tree where we construct the
logfile name from stepno and step:
 * tcl/JobDB-Executive            main decision about logfile name  } OK
 * JobDB::Executive               final fallback for new steps      } keep
 * steps-logfile-constraint.sql   default for old data              }
 * sg-report-flight (twice)   } both read stepno and step from the db;
 * determine-failure-reasons  }  here we teach them to try logfile first

Now substep logs will have correct links in the job output, as soon as
the logfile column has the right data.

This is part of a "Populate-then-rely" schema change, as described in
schema/README.updates.  Specifically, this is the step:

6. Optionally commit: code which reads new column, but which tolerates
   it containing NULL/DEFAULT.  (`add' is already Needed.)

Signed-off-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
---
 determine-failure-reasons | 2 +-
 sg-report-flight          | 5 +++--
 2 files changed, 4 insertions(+), 3 deletions(-)
diff mbox

Patch

diff --git a/determine-failure-reasons b/determine-failure-reasons
index a3b2100..89c67e6 100755
--- a/determine-failure-reasons
+++ b/determine-failure-reasons
@@ -52,7 +52,7 @@  sub gethosts ($) {
 }
 
 while (my $step= $stepsq->fetchrow_hashref) {
-    my $logfile = "$step->{stepno}.$step->{step}.log";
+    my $logfile = $step->{logfile} // "$step->{stepno}.$step->{step}.log";
     $step->{Log}= "$c{Logs}/$step->{flight}/$step->{job}/".$logfile;
 
     if (!stat $step->{Log}) {
diff --git a/sg-report-flight b/sg-report-flight
index ec30ed0..4e3560e 100755
--- a/sg-report-flight
+++ b/sg-report-flight
@@ -1001,7 +1001,8 @@  END
         printf H "<td>%s</td>", show_abs_time $step->{started};
 
         my $st= $step->{status};
-        my $logfilename= "$step->{stepno}.$step->{step}.log";
+        my $logfilename= $step->{logfile}
+	    // "$step->{stepno}.$step->{step}.log";
         printf H "<td bgcolor='%s'><a href='%s'>%s</a></td>",
 	    (html_status2_colour_priority($st))[0],
             encode_entities(uri_escape($logfilename)),
@@ -1167,7 +1168,7 @@  END
 		: ('#ffff00',250);
 	}
 	my $ch = "bgcolor=\"$bgc\"";
-	my $logfilename= "$s->{stepno}.$s->{step}.log";
+	my $logfilename= $s->{logfile} // "$s->{stepno}.$s->{step}.log";
 	my $h = "<a href=\"".encode_entities($s->{job}).
 	    "/".encode_entities($logfilename)."\">";
 	#print H "[$s->{stepno}] ";