smartd_log plugin: fix plugin fail when log dir is not exist
Ilya committed
Feb 1, 2017 at 22:03 UTC
048912bb6d7b65645b909341da4458aa26c9ca4a
1 file changed
+4
-3
python.d/smartd_log.chart.py
+4
-3
@@ -4,11 +4,11 @@
4
5
from re import compile
6
from os import listdir, access, R_OK
7
-from os.path import isfile, join, getsize, basename
7
+from os.path import isfile, join, getsize, basename, isdir
8
try:
9
- from queue import Queue
9
+ from queue import Queue
10
except ImportError:
11
- from Queue import Queue
11
+ from Queue import Queue
12
from threading import Thread
13
from base import SimpleService
14
from collections import namedtuple
@@ -216,5 +216,6 @@ def find_disks_in_log_path(log_path):
216
# 1. it is a file
217
# 2. file name endswith with 'csv'
218
# 3. file is readable
219
+ if not isdir(log_path): return None
220
return [join(log_path, f) for f in listdir(log_path)
221
if all([isfile(join(log_path, f)), f.endswith('.csv'), access(join(log_path, f), R_OK)])]