diff options
author | Alessio Sergi <al3hex@gmail.com> | 2017-01-09 13:29:51 +0100 |
---|---|---|
committer | Alessio Sergi <al3hex@gmail.com> | 2017-01-09 16:01:07 +0100 |
commit | 870758a9e6b3303f5ab0f9c09f565310af1971c3 (patch) | |
tree | 30bf85a647a5209b38a4be71d991063de8ac0dc0 | |
parent | 92e76ff61211d51385a1ae826eb5cc906ebe273a (diff) |
folder_list: remove superfluous try/except when reading config values
config.get_value() already handles NoOptionError in this case.
-rw-r--r-- | glances/folder_list.py | 14 |
1 files changed, 4 insertions, 10 deletions
diff --git a/glances/folder_list.py b/glances/folder_list.py index 6d243772..c54eef54 100644 --- a/glances/folder_list.py +++ b/glances/folder_list.py @@ -81,20 +81,14 @@ class FolderList(object): key = 'folder_' + str(l) + '_' # Path is mandatory - try: - value['path'] = self.config.get_value(section, key + 'path') - except Exception as e: - logger.error("Cannot read folder list: {}".format(e)) - continue + value['path'] = self.config.get_value(section, key + 'path') if value['path'] is None: continue # Optional conf keys for i in ['careful', 'warning', 'critical']: - try: - value[i] = self.config.get_value(section, key + i) - except Exception: - value[i] = None + value[i] = self.config.get_value(section, key + i) + if value[i] is None: logger.debug("No {} threshold for folder {}".format(i, value["path"])) # Add the item to the list @@ -153,7 +147,7 @@ class FolderList(object): # Update folder size try: self.__folder_list[i]['size'] = self.__folder_size(self.path(i)) - except Exception as e: + except OSError as e: logger.debug('Cannot get folder size ({}). Error: {}'.format(self.path(i), e)) if e.errno == 13: # Permission denied |