提交 522acfca 编写于 作者: N Nicolas Hennion

Correct pb if array stats are None

上级 c22d4407
...@@ -62,7 +62,7 @@ class Plugin(GlancesPlugin): ...@@ -62,7 +62,7 @@ class Plugin(GlancesPlugin):
# Update stats using the PyMDstat lib (https://github.com/nicolargo/pymdstat) # Update stats using the PyMDstat lib (https://github.com/nicolargo/pymdstat)
try: try:
# !!! Path ONLY for dev # !!! Path ONLY for dev
mds = MdStat('/home/nicolargo/dev/pymdstat/tests/mdstat.09') mds = MdStat('/home/nicolargo/dev/pymdstat/tests/mdstat.08')
self.stats = mds.get_stats()['arrays'] self.stats = mds.get_stats()['arrays']
except Exception as e: except Exception as e:
logger.debug("Can not grab RAID stats (%s)" % e) logger.debug("Can not grab RAID stats (%s)" % e)
...@@ -101,7 +101,8 @@ class Plugin(GlancesPlugin): ...@@ -101,7 +101,8 @@ class Plugin(GlancesPlugin):
# Display the current status # Display the current status
status = self.raid_alert(self.stats[array]['status'], self.stats[array]['used'], self.stats[array]['available']) status = self.raid_alert(self.stats[array]['status'], self.stats[array]['used'], self.stats[array]['available'])
# Data: RAID type name | disk used | disk available # Data: RAID type name | disk used | disk available
msg = '{0:<5}{1:>6}'.format(self.stats[array]['type'].upper(), array) array_type = self.stats[array]['type'].upper() if self.stats[array]['type'] is not None else _('UNKNOWN')
msg = '{0:<5}{1:>6}'.format(array_type, array)
ret.append(self.curse_add_line(msg)) ret.append(self.curse_add_line(msg))
if self.stats[array]['status'] == 'active': if self.stats[array]['status'] == 'active':
msg = '{0:>5}'.format(self.stats[array]['used']) msg = '{0:>5}'.format(self.stats[array]['used'])
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册