summaryrefslogtreecommitdiff
path: root/kvmd/plugins/msd/otg/__init__.py
diff options
context:
space:
mode:
authorMaxim Devaev <[email protected]>2023-03-03 02:20:41 +0200
committerMaxim Devaev <[email protected]>2023-03-04 16:13:04 +0200
commitedd9435945a93e343f47344b689a17837fd5a738 (patch)
treea4319dbb9f599b051733fbf6151214129e4a7cb4 /kvmd/plugins/msd/otg/__init__.py
parent5bc480c6e87319377604eed11ced18f0bbc4001e (diff)
refactoring
Diffstat (limited to 'kvmd/plugins/msd/otg/__init__.py')
-rw-r--r--kvmd/plugins/msd/otg/__init__.py10
1 files changed, 6 insertions, 4 deletions
diff --git a/kvmd/plugins/msd/otg/__init__.py b/kvmd/plugins/msd/otg/__init__.py
index e8805313..d7bbb571 100644
--- a/kvmd/plugins/msd/otg/__init__.py
+++ b/kvmd/plugins/msd/otg/__init__.py
@@ -183,6 +183,7 @@ class Plugin(BaseMsd): # pylint: disable=too-many-instance-attributes
for name in list(storage["images"]):
del storage["images"][name]["path"]
del storage["images"][name]["in_storage"]
+ del storage["images"][name]["storage"]
storage["downloading"] = (self.__reader.get_state() if self.__reader else None)
@@ -200,6 +201,7 @@ class Plugin(BaseMsd): # pylint: disable=too-many-instance-attributes
vd = dataclasses.asdict(self.__state.vd)
if vd["image"]:
del vd["image"]["path"]
+ del vd["image"]["storage"]
return {
"enabled": True,
@@ -336,7 +338,7 @@ class Plugin(BaseMsd): # pylint: disable=too-many-instance-attributes
raise MsdImageExistsError()
await self.__remount_rw(True)
- self.__storage.set_image_complete(image, False)
+ image.set_complete(False)
self.__writer = await MsdFileWriter(
notifier=self.__notifier,
@@ -348,11 +350,11 @@ class Plugin(BaseMsd): # pylint: disable=too-many-instance-attributes
self.__notifier.notify()
yield self.__writer
- self.__storage.set_image_complete(image, self.__writer.is_complete())
+ image.set_complete(self.__writer.is_complete())
finally:
if image and remove_incomplete and self.__writer and not self.__writer.is_complete():
- self.__storage.remove_image(image, fatal=False)
+ image.remove(fatal=False)
try:
await aiotools.shield_fg(self.__close_writer())
finally:
@@ -377,7 +379,7 @@ class Plugin(BaseMsd): # pylint: disable=too-many-instance-attributes
await self.__remount_rw(True)
try:
- self.__storage.remove_image(image, fatal=True)
+ image.remove(fatal=True)
finally:
await self.__remount_rw(False, fatal=False)