some adjustment to Log check
--
Rakesh Pandit
https://fedoraproject.org/
freedom, friends, features, first
From: Rakesh Pandit <rakesh(a)fedoraproject.org>
Date: Thu, 26 Nov 2009 06:18:01 +0000 (+0530)
Subject: BuildLog.py: Fixed log file exception.
X-Git-Url:
http://git.fedorahosted.org/git/gach.git/?p=gach.git;a=commitdiff_plain;h...
BuildLog.py: Fixed log file exception.
LogWarningCheck.py: Adjusted report for no log.
---
diff --git a/BuildLog.py b/BuildLog.py
index 866215d..e95a79d 100644
--- a/BuildLog.py
+++ b/BuildLog.py
@@ -27,7 +27,14 @@ class BuildLog(object):
self.file = file
self.filename = os.path.basename(file)
self.path = os.path.dirname(file)
- fobj = open(self.file, "r")
+ self.log_lines = []
+
+ fobj = None
+ try:
+ fobj = open(self.file, "r")
+ except IOError:
+ # Return in case no log found
+ return
try:
self.log_lines = fobj.readlines()
finally:
diff --git a/LogWarningCheck.py b/LogWarningCheck.py
index c257ab3..cbe4713 100644
--- a/LogWarningCheck.py
+++ b/LogWarningCheck.py
@@ -41,11 +41,14 @@ class LogWarningCheck(Check.Check):
"""
log_file = details["log"]
log = BuildLog(log_file)
- reporter.printDividerInfo("Log info %s" %(log_file))
-
# Grep all lines
lines = log.searchstring(["warning", "Warning",
"WARNING"])
+ # Return if no warnings found
+ if not lines:
+ return
+
+ reporter.printDividerInfo("Log info %s" %(log_file))
for line in lines:
reporter.printLogWarnings(line)