0
0
Fork 0
mirror of https://github.com/netdata/netdata.git synced 2025-05-01 07:59:52 +00:00

smartd_log: Disk __eq__ fix ()

This commit is contained in:
Ilya Mashchenko 2019-07-25 11:43:28 +03:00 committed by GitHub
parent 8e695f03c9
commit b74cc9af07
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -558,6 +558,7 @@ class DiskLogFile:
class BaseDisk: class BaseDisk:
def __init__(self, name, log_file): def __init__(self, name, log_file):
self.raw_name = name
self.name = re.sub(r'_+', '_', name) self.name = re.sub(r'_+', '_', name)
self.log_file = log_file self.log_file = log_file
self.attrs = list() self.attrs = list()
@ -566,8 +567,8 @@ class BaseDisk:
def __eq__(self, other): def __eq__(self, other):
if isinstance(other, BaseDisk): if isinstance(other, BaseDisk):
return self.name == other.name return self.raw_name == other.raw_name
return self.name == other return self.raw_name == other
def __ne__(self, other): def __ne__(self, other):
return not self == other return not self == other
@ -657,7 +658,7 @@ class Service(SimpleService):
not disk.log_file.is_active(current_time, self.age), not disk.log_file.is_active(current_time, self.age),
] ]
): ):
self.disks.remove(disk.name) self.disks.remove(disk.raw_name)
self.remove_disk_from_charts(disk) self.remove_disk_from_charts(disk)
def scan(self): def scan(self):
@ -681,9 +682,11 @@ class Service(SimpleService):
path = os.path.join(self.log_path, full_name) path = os.path.join(self.log_path, full_name)
if name in self.disks: if name in self.disks:
self.debug('skipping {0}: already in disks'.format(full_name))
return None return None
if [p for p in self.exclude if p in name]: if [p for p in self.exclude if p in name]:
self.debug('skipping {0}: filtered by `exclude` option'.format(full_name))
return None return None
if not os.access(path, os.R_OK): if not os.access(path, os.R_OK):