summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authornicolargo <nicolas@nicolargo.com>2021-03-05 14:04:20 +0100
committernicolargo <nicolas@nicolargo.com>2021-03-05 14:04:20 +0100
commitd201e647aa4995231b32e6bb39d16f8c8ce95d23 (patch)
tree53ca21f54b889ee5cc8ef317c1ba32f7aa27b215
parentadbad550cdcf371a9eb9c3f6bbefff011fc7a234 (diff)
Smart plugin error while start glances as root #1806
-rw-r--r--glances/plugins/glances_smart.py13
1 files changed, 11 insertions, 2 deletions
diff --git a/glances/plugins/glances_smart.py b/glances/plugins/glances_smart.py
index 445942cb..e63ebfd8 100644
--- a/glances/plugins/glances_smart.py
+++ b/glances/plugins/glances_smart.py
@@ -95,7 +95,15 @@ def get_smart_data():
"""
stats = []
# get all devices
- devlist = DeviceList()
+ try:
+ devlist = DeviceList()
+ except TypeError as e:
+ # Catch error (see #1806)
+ logger.debug(
+ 'Smart plugin error - Can not grab device list ({})'.format(e))
+ global import_error_tag
+ import_error_tag = True
+ return stats
for dev in devlist.devices:
stats.append({
@@ -113,6 +121,7 @@ def get_smart_data():
assert num is not None
except Exception as e:
# we should never get here, but if we do, continue to next iteration and skip this attribute
+ logger.debug('Smart plugin error - Skip the attribute {} ({})'.format(attribute, e))
continue
stats[-1][num] = attribdict
@@ -171,7 +180,7 @@ class Plugin(GlancesPlugin):
ret = []
# Only process if stats exist...
- if not self.stats or self.is_disable():
+ if import_error_tag or not self.stats or self.is_disable():
return ret
# Max size for the interface name