From: Ian Jackson Subject: [OSSTEST PATCH] ts-logs-capture: Actually do hard host reboot sometimes Date: Thu, 1 Oct 2015 12:14:21 +0100 Message-ID: <1443698061-11382-1-git-send-email-ian.jackson@eu.citrix.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mail6.bemta5.messagelabs.com ([195.245.231.135]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1Zhbom-0006Oz-0l for xen-devel@lists.xenproject.org; Thu, 01 Oct 2015 11:14:32 +0000 List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: xen-devel@lists.xenproject.org Cc: Ian Jackson , Ian Campbell List-Id: xen-devel@lists.xenproject.org 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 --- 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