RF: Filter.getLogPaths -> getLogs

Since it returns log containers not paths per se
pull/1266/head
Yaroslav Halchenko 9 years ago
parent 6ce7522d3c
commit dd9d1912e8

@ -565,7 +565,7 @@ class FileFilter(Filter):
# #
# @param path log file path # @param path log file path
def addLogPath(self, path, tail = False): def addLogPath(self, path, tail=False):
if path in self.__logs: if path in self.__logs:
logSys.error(path + " already exists") logSys.error(path + " already exists")
else: else:
@ -607,11 +607,11 @@ class FileFilter(Filter):
pass pass
## ##
# Get the log file path # Get the log containers
# #
# @return log file path # @return log containers
def getLogPath(self): def getLogs(self):
return self.__logs.values() return self.__logs.values()
## ##

@ -129,6 +129,6 @@ class FilterGamin(FileFilter):
# Desallocates the resources used by Gamin. # Desallocates the resources used by Gamin.
def __cleanup(self): def __cleanup(self):
for path in self.getLogPath(): for log in self.getLogs():
self.monitor.stop_watch(path.getFileName()) self.monitor.stop_watch(log.getFileName())
del self.monitor del self.monitor

@ -88,10 +88,10 @@ class FilterPoll(FileFilter):
while self.active: while self.active:
if logSys.getEffectiveLevel() <= 6: if logSys.getEffectiveLevel() <= 6:
logSys.log(6, "Woke up idle=%s with %d files monitored", logSys.log(6, "Woke up idle=%s with %d files monitored",
self.idle, len(self.getLogPath())) self.idle, len(self.getLogs()))
if not self.idle: if not self.idle:
# Get file modification # Get file modification
for container in self.getLogPath(): for container in self.getLogs():
filename = container.getFileName() filename = container.getFileName()
if self.isModified(filename): if self.isModified(filename):
self.getFailures(filename) self.getFailures(filename)

@ -212,7 +212,7 @@ class Server:
filter_ = self.__jails[name].filter filter_ = self.__jails[name].filter
if isinstance(filter_, FileFilter): if isinstance(filter_, FileFilter):
return [m.getFileName() return [m.getFileName()
for m in filter_.getLogPath()] for m in filter_.getLogs()]
else: # pragma: systemd no cover else: # pragma: systemd no cover
logSys.info("Jail %s is not a FileFilter instance" % name) logSys.info("Jail %s is not a FileFilter instance" % name)
return [] return []

@ -853,11 +853,11 @@ class GetFailures(LogCaptureTestCase):
def testTail(self): def testTail(self):
self.filter.addLogPath(GetFailures.FILENAME_01, tail=True) self.filter.addLogPath(GetFailures.FILENAME_01, tail=True)
self.assertEqual(self.filter.getLogPath()[-1].getPos(), 1653) self.assertEqual(self.filter.getLogs()[-1].getPos(), 1653)
self.filter.getLogPath()[-1].close() self.filter.getLogs()[-1].close()
self.assertEqual(self.filter.getLogPath()[-1].readline(), "") self.assertEqual(self.filter.getLogs()[-1].readline(), "")
self.filter.delLogPath(GetFailures.FILENAME_01) self.filter.delLogPath(GetFailures.FILENAME_01)
self.assertEqual(self.filter.getLogPath(),[]) self.assertEqual(self.filter.getLogs(), [])
def testNoLogAdded(self): def testNoLogAdded(self):
self.filter.addLogPath(GetFailures.FILENAME_01, tail=True) self.filter.addLogPath(GetFailures.FILENAME_01, tail=True)

Loading…
Cancel
Save