Don't barf if we can't monitor all log files.

Change-Id: I6e867fe13e55da8661501c8df0cc445afbed528c
This commit is contained in:
Michael Still
2014-01-06 19:51:06 +11:00
parent 8cb3549b0c
commit be745262a5

View File

@@ -112,13 +112,20 @@ def execute_to_log(cmd, logfile, timeout=-1,
descriptors = {}
for watch_file in watch_logs:
fd = os.open(watch_file[1], os.O_RDONLY)
os.lseek(fd, 0, os.SEEK_END)
descriptors[fd] = dict(
name=watch_file[0],
poll=select.POLLIN,
lines=''
)
if not os.path.exists(watch_file[1]):
logger.warning('Failed to monitor log file %s: file not found'
% watch_file[1])
continue
try:
fd = os.open(watch_file[1], os.O_RDONLY)
os.lseek(fd, 0, os.SEEK_END)
descriptors[fd] = {'name': watch_file[0],
'poll': select.POLLIN,
'lines': ''}
except Exception as e:
logger.warning('Failed to monitor log file %s: %s'
% (watch_file[1], e))
cmd += ' 2>&1'
start_time = time.time()