Merge pull request #1571 from qubidt/develop

Fix broken method call when config is None
This commit is contained in:
Nicolas Hennion 2019-12-17 21:19:14 +01:00 committed by GitHub
commit d7a39721f8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -117,9 +117,10 @@ class Plugin(GlancesPlugin):
self.pid_max = glances_processes.pid_max
# Set the default sort key if it is defined in the configuration file
if 'processlist' in config.as_dict() and 'sort_key' in config.as_dict()['processlist']:
logger.debug('Configuration overwrites processes sort key by {}'.format(config.as_dict()['processlist']['sort_key']))
glances_processes.set_sort_key(config.as_dict()['processlist']['sort_key'], False)
if config is not None:
if 'processlist' in config.as_dict() and 'sort_key' in config.as_dict()['processlist']:
logger.debug('Configuration overwrites processes sort key by {}'.format(config.as_dict()['processlist']['sort_key']))
glances_processes.set_sort_key(config.as_dict()['processlist']['sort_key'], False)
# Note: 'glances_processes' is already init in the processes.py script