diff mbox

[OSSTEST,1/2] Executive: Break out task_spec_desc (no functional change)

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

Commit Message

Ian Jackson Oct. 6, 2016, 4:35 p.m. UTC
Signed-off-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
---
 Osstest/Executive.pm | 25 +++++++++++++++++--------
 1 file changed, 17 insertions(+), 8 deletions(-)
diff mbox

Patch

diff --git a/Osstest/Executive.pm b/Osstest/Executive.pm
index 137eb44..14f75b3 100644
--- a/Osstest/Executive.pm
+++ b/Osstest/Executive.pm
@@ -45,7 +45,7 @@  BEGIN {
     $VERSION     = 1.00;
     @ISA         = qw(Exporter);
     @EXPORT      = qw(grabrepolock_reexec
-                      findtask findtask_spec @all_lock_tables
+                      task_spec_desc findtask findtask_spec @all_lock_tables
                       restrictflight_arg restrictflight_cond
                       report_run_getinfo report_altcolour
                       report_altchangecolour
@@ -524,6 +524,20 @@  END
 
 our $taskid;
 
+sub task_spec_desc ($) {
+    my ($row) = @_; # NB row maybe modifed, to fill in username and comment
+    # => ($newspec, $desc);
+
+    foreach my $k (qw(username comment)) {
+        next if defined $row->{$k};
+        $row->{$k}= "[no $k]";
+    }
+
+    my $newspec = "$row->{taskid} $row->{type} $row->{refkey}";
+    my $desc = "$row->{username} $row->{comment}";
+    return ($newspec,$desc);
+}
+
 sub findtask_spec ($$) {
     my ($spec, $why) = @_;
 
@@ -556,13 +570,8 @@  END
     die "task $what dead" unless $row->{live};
     $q->finish();
 
-    foreach my $k (qw(username comment)) {
-        next if defined $row->{$k};
-        $row->{$k}= "[no $k]";
-    }
-
-    my $newspec= "$row->{taskid} $row->{type} $row->{refkey}";
-    logm("${why}task $newspec: $row->{username} $row->{comment}");
+    my ($newspec, $desc) = task_spec_desc($row);
+    logm("${why}task $newspec: $desc");
 
     $taskid= $row->{taskid};