diff options
-rw-r--r-- | NEWS | 6 | ||||
-rw-r--r-- | conf/glances.conf | 3 | ||||
-rw-r--r-- | docs/aoa/folders.rst | 2 | ||||
-rw-r--r-- | docs/man/glances.1 | 2 | ||||
-rw-r--r-- | glances/folder_list.py | 6 | ||||
-rw-r--r-- | glances/plugins/glances_folders.py | 10 | ||||
-rw-r--r-- | glances/plugins/glances_hddtemp.py | 1 |
7 files changed, 20 insertions, 10 deletions
@@ -5,9 +5,13 @@ Glances Version 2 Version 2.7 =========== +Enhancements and new features: + + * [Folders] Differentiate permission issue and non-existence of a directory #828 + Bugs corrected: - * Crash on launch when viewing temperature of laptop HDD in sleep mode (issue #824) + * Crash on launch when viewing temperature of laptop HDD in sleep mode (issue #824) * [Web UI] Fix folders plugin never displayed (issue #829) Version 2.6.1 diff --git a/conf/glances.conf b/conf/glances.conf index 8c8cfe0e..2ca4c4c0 100644 --- a/conf/glances.conf +++ b/conf/glances.conf @@ -101,7 +101,7 @@ critical=90 # Allow additional file system types (comma-separated FS type) #allow=zfs -#[folders] +[folders] # Define a folder list to monitor # The list is composed of items (list_#nb <= 10) # An item is defined by: @@ -117,6 +117,7 @@ critical=90 #folder_2_warning=17000 #folder_2_critical=20000 #folder_3_path=/nonexisting +#folder_4_path=/root [sensors] # Sensors core thresholds (in Celsius...) diff --git a/docs/aoa/folders.rst b/docs/aoa/folders.rst index 5245c9d1..51305965 100644 --- a/docs/aoa/folders.rst +++ b/docs/aoa/folders.rst @@ -8,7 +8,7 @@ monitor size of a predefined folders list. .. image:: ../_static/folders.png -If the size can not be computed (non existing folder, read right error), a '?' is displayed. +If the size can not be computed, a '?' (non existing folder) or a '!' (read right error) is displayed. Each item is defined by: diff --git a/docs/man/glances.1 b/docs/man/glances.1 index e1adc7bd..e7bc193c 100644 --- a/docs/man/glances.1 +++ b/docs/man/glances.1 @@ -1,6 +1,6 @@ .\" Man page generated from reStructuredText. . -.TH "GLANCES" "1" "March 26, 2016" "2.6.1" "Glances" +.TH "GLANCES" "1" "March 28, 2016" "2.7_BETA" "Glances" .SH NAME glances \- An eye on your system . diff --git a/glances/folder_list.py b/glances/folder_list.py index acd1960f..d8e4d4c4 100644 --- a/glances/folder_list.py +++ b/glances/folder_list.py @@ -154,8 +154,12 @@ class FolderList(object): try: self.__folder_list[i]['size'] = self.__folder_size(self.path(i)) except Exception as e: - self.__folder_list[i]['size'] = None logger.debug('Can get folder size ({0}). Error: {1}'.format(self.path(i), e)) + if e.errno == 13: + # Permission denied + self.__folder_list[i]['size'] = '!' + else: + self.__folder_list[i]['size'] = '?' return self.__folder_list diff --git a/glances/plugins/glances_folders.py b/glances/plugins/glances_folders.py index 3eee1254..0a7abc4c 100644 --- a/glances/plugins/glances_folders.py +++ b/glances/plugins/glances_folders.py @@ -2,7 +2,7 @@ # # This file is part of Glances. # -# Copyright (C) 2015 Nicolargo <nicolas@nicolargo.com> +# Copyright (C) 2016 Nicolargo <nicolas@nicolargo.com> # # Glances is free software; you can redistribute it and/or modify # it under the terms of the GNU Lesser General Public License as published by @@ -19,6 +19,8 @@ """Folder plugin.""" +import numbers + from glances.folder_list import FolderList as glancesFolderList from glances.plugins.glances_plugin import GlancesPlugin @@ -74,7 +76,7 @@ class Plugin(GlancesPlugin): def get_alert(self, stat): """Manage limits of the folder list""" - if stat['size'] is None: + if not isinstance(stat['size'], numbers.Number): return 'DEFAULT' else: ret = 'OK' @@ -114,8 +116,8 @@ class Plugin(GlancesPlugin): ret.append(self.curse_add_line(msg)) try: msg = '{0:>6}'.format(self.auto_unit(i['size'])) - except TypeError: - msg = '{0:>6}'.format('?') + except (TypeError, ValueError): + msg = '{0:>6}'.format(i['size']) ret.append(self.curse_add_line(msg, self.get_alert(i))) return ret diff --git a/glances/plugins/glances_hddtemp.py b/glances/plugins/glances_hddtemp.py index 1b279f7b..c3da6908 100644 --- a/glances/plugins/glances_hddtemp.py +++ b/glances/plugins/glances_hddtemp.py @@ -21,7 +21,6 @@ import os import socket -import numbers from glances.compat import nativestr, range from glances.logger import logger |