From dc3392c11d27f9a0e0d3d6c4c8147dde8fb38ba0 Mon Sep 17 00:00:00 2001 From: Fabio Manganiello Date: Sun, 23 Apr 2023 22:25:24 +0200 Subject: [PATCH] Disk I/O stats are not always available and should therefore be optional. --- platypush/plugins/system/__init__.py | 2 +- platypush/schemas/system/_disk/_model.py | 14 +++++++------- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/platypush/plugins/system/__init__.py b/platypush/plugins/system/__init__.py index 1bb1a24299..0b2c06a1c3 100644 --- a/platypush/plugins/system/__init__.py +++ b/platypush/plugins/system/__init__.py @@ -240,7 +240,7 @@ class SystemPlugin(SensorPlugin, EntityManager): [ { **info, - **io_stats[part], + **io_stats.get(part, {}), **usage[part], } for part, info in parts.items() diff --git a/platypush/schemas/system/_disk/_model.py b/platypush/schemas/system/_disk/_model.py index c87c194dd4..822ec99837 100644 --- a/platypush/schemas/system/_disk/_model.py +++ b/platypush/schemas/system/_disk/_model.py @@ -70,7 +70,7 @@ class Disk: } ) - read_count: int = field( + read_count: Optional[int] = field( metadata={ 'metadata': { 'description': 'Number of recorded read operations', @@ -78,7 +78,7 @@ class Disk: } ) - write_count: int = field( + write_count: Optional[int] = field( metadata={ 'metadata': { 'description': 'Number of recorded write operations', @@ -86,7 +86,7 @@ class Disk: } ) - read_bytes: int = field( + read_bytes: Optional[int] = field( metadata={ 'metadata': { 'description': 'Number of read bytes', @@ -94,7 +94,7 @@ class Disk: } ) - write_bytes: int = field( + write_bytes: Optional[int] = field( metadata={ 'metadata': { 'description': 'Number of written bytes', @@ -102,7 +102,7 @@ class Disk: } ) - read_time: float = field( + read_time: Optional[float] = field( metadata={ 'metadata': { 'description': 'Time spent reading, in seconds', @@ -110,7 +110,7 @@ class Disk: } ) - write_time: float = field( + write_time: Optional[float] = field( metadata={ 'metadata': { 'description': 'Time spent writing, in seconds', @@ -118,7 +118,7 @@ class Disk: } ) - busy_time: float = field( + busy_time: Optional[float] = field( metadata={ 'metadata': { 'description': 'Total disk busy time, in seconds',