All of lore.kernel.org
 help / color / mirror / Atom feed
* [OSSTEST PATCH] ts-logs-capture: Actually do hard host reboot sometimes
@ 2015-10-01 11:14 Ian Jackson
  2015-10-01 11:27 ` Ian Campbell
  0 siblings, 1 reply; 2+ messages in thread
From: Ian Jackson @ 2015-10-01 11:14 UTC (permalink / raw)
  To: xen-devel; +Cc: Ian Jackson, Ian Campbell

The logic in try_fetch_logs for setting $ok was wrong.  $ok would be
set if we reached the end of any outer (pattern) loop iteration.  If
the host is actually dead all the pattern expansions would fail, but
some of the patterns are literals and do not need expansion.  The
inner (logfile) loop would say `next' if the logfile fetch failed, but
that just goes onto the next logfile.  So this code would always set
$ok.

Instead, set $ok to 1 when we successfuly fetch any logfile or
successfully expanded any pattern (even if it didn't match any files).

Signed-off-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
---
 ts-logs-capture |    5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/ts-logs-capture b/ts-logs-capture
index b99b1db..ab6750d 100755
--- a/ts-logs-capture
+++ b/ts-logs-capture
@@ -78,6 +78,8 @@ END
                 logm("logfile $logfilepat pattern expansion failed: $@");
                 next;
             }
+            logm("at least one pattern expansion succeeded") if !$ok;
+            $ok= 1;
             next if $logfileslist eq $logfilepat;
         }
         foreach my $logfile (split / /, $logfileslist) {
@@ -97,8 +99,9 @@ END
                 logm("logfile $logfile fetch failed: $@");
                 next;
             }
+            logm("at least one logfile fetched") if !$ok;
+            $ok= 1;
         }
-        $ok= 1;
     }
     return $ok;
 }
-- 
1.7.10.4

^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2015-10-01 11:27 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-10-01 11:14 [OSSTEST PATCH] ts-logs-capture: Actually do hard host reboot sometimes Ian Jackson
2015-10-01 11:27 ` Ian Campbell

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.