mirror of
https://github.com/YunoHost/yunohost.git
synced 2024-09-03 20:06:10 +02:00
[fix] Replace deprecated psutil.BOOT_TIME attribute
The `psutil.BOOT_TIME` attribute appears to be deprecated, and returns an `AttributeError` when called. Even though the psutil documentation states that old attributes should be callable, one should use `psutil.boot_time()` function instead. In some version of psutil (e.g. 2.1.1), both appear callable. In old versions (e.g. 1.2.1), `psutil.BOOT_TIME` is but `psutil.boot_time()` is not. In the newest version (4.3.0), only the latter can be called. This bug would introduce an Internal Server Error (Error 500) when accessing the Monitor tool in the YunoHost admin panel.
This commit is contained in:
parent
f7add32acb
commit
53e19fa32d
1 changed files with 1 additions and 1 deletions
|
@ -283,7 +283,7 @@ def monitor_system(units=None, human_readable=False):
|
|||
elif u == 'process':
|
||||
result[u] = json.loads(glances.getProcessCount())
|
||||
elif u == 'uptime':
|
||||
result[u] = (str(datetime.now() - datetime.fromtimestamp(psutil.BOOT_TIME)).split('.')[0])
|
||||
result[u] = (str(datetime.now() - datetime.fromtimestamp(psutil.boot_time())).split('.')[0])
|
||||
elif u == 'infos':
|
||||
result[u] = json.loads(glances.getSystem())
|
||||
else:
|
||||
|
|
Loading…
Add table
Reference in a new issue