500 Internal Server Error /api/3/network/interface_name #1401

This commit is contained in:
nicolargo 2019-01-23 21:47:50 +01:00
parent c35a7dacfc
commit 91a96edd58
2 changed files with 5 additions and 2 deletions

4
NEWS
View File

@ -12,7 +12,9 @@ Enhancements and new features:
Bugs corrected:
* ...
* Fix Cassandra table name export #1402
* Permission denied: '/etc/glances/glances.conf' #1403
* 500 Internal Server Error /api/3/network/interface_name #1401
Others:

View File

@ -390,7 +390,8 @@ class GlancesPlugin(object):
try:
# Source:
# http://stackoverflow.com/questions/4573875/python-get-index-of-dictionary-item-in-list
return self._json_dumps({item: map(itemgetter(item), self.stats)})
# But https://github.com/nicolargo/glances/issues/1401
return self._json_dumps({item: list(map(itemgetter(item), self.stats))})
except (KeyError, ValueError) as e:
logger.error("Cannot get item {} ({})".format(item, e))
return None