smartd_log: Disk __eq__ fix (#6540)
Ilya Mashchenko committed
Jul 25, 2019 at 11:43 UTC
b74cc9af0707957c9f7d252eae8fd20c9b091aff
1 file changed
+6
-3
collectors/python.d.plugin/smartd_log/smartd_log.chart.py
+6
-3
@@ -558,6 +558,7 @@ class DiskLogFile:
558
559
class BaseDisk:
560
def __init__(self, name, log_file):
561
+ self.raw_name = name
562
self.name = re.sub(r'_+', '_', name)
563
self.log_file = log_file
564
self.attrs = list()
@@ -566,8 +567,8 @@ class BaseDisk:
567
568
def __eq__(self, other):
569
if isinstance(other, BaseDisk):
569
- return self.name == other.name
570
- return self.name == other
570
+ return self.raw_name == other.raw_name
571
+ return self.raw_name == other
572
573
def __ne__(self, other):
574
return not self == other
@@ -657,7 +658,7 @@ class Service(SimpleService):
658
not disk.log_file.is_active(current_time, self.age),
659
]
660
):
660
- self.disks.remove(disk.name)
661
+ self.disks.remove(disk.raw_name)
662
self.remove_disk_from_charts(disk)
663
664
def scan(self):
@@ -681,9 +682,11 @@ class Service(SimpleService):
682
path = os.path.join(self.log_path, full_name)
683
684
if name in self.disks:
685
+ self.debug('skipping {0}: already in disks'.format(full_name))
686
return None
687
688
if [p for p in self.exclude if p in name]:
689
+ self.debug('skipping {0}: filtered by `exclude` option'.format(full_name))
690
return None
691
692
if not os.access(path, os.R_OK):