summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDevaev Maxim <[email protected]>2019-06-03 00:14:10 +0300
committerDevaev Maxim <[email protected]>2019-06-03 00:14:10 +0300
commitd1266ea09b7b8ab4f10b31b6b191421252defa8e (patch)
treec5754cce904bc7cac78477cde648f52bf5d55d45
parenteb61c48ef0349287d0e63b83a664ff572ec52fe3 (diff)
fixed dataclass asdict
-rw-r--r--kvmd/apps/kvmd/msd.py13
1 files changed, 2 insertions, 11 deletions
diff --git a/kvmd/apps/kvmd/msd.py b/kvmd/apps/kvmd/msd.py
index d8b6b69e..6fb308a7 100644
--- a/kvmd/apps/kvmd/msd.py
+++ b/kvmd/apps/kvmd/msd.py
@@ -253,22 +253,13 @@ class MassStorageDevice: # pylint: disable=too-many-instance-attributes
def get_state(self) -> Dict:
online = (self._enabled and bool(self._device_path))
- info = (dataclasses.asdict(self.__saved_device_info) if self.__saved_device_info else None)
- connected_to: Optional[str] = None
-
- if online:
- if info:
- info["hw"] = (dataclasses.asdict(info["hw"]) if info["hw"] else None)
- info["image"] = (dataclasses.asdict(info["image"]) if info["image"] else None)
- connected_to = ("kvm" if self.__device_info else "server")
-
return {
"enabled": self._enabled,
"online": online,
- "connected_to": connected_to,
+ "connected_to": (("kvm" if self.__device_info else "server") if online else None),
"busy": bool(self.__device_file),
"written": self.__written,
- "info": info,
+ "info": (dataclasses.asdict(self.__saved_device_info) if self.__saved_device_info else None),
}
async def poll_state(self) -> AsyncGenerator[Dict, None]: