summaryrefslogtreecommitdiff
path: root/kvmd/plugins/msd/disabled.py
diff options
context:
space:
mode:
Diffstat (limited to 'kvmd/plugins/msd/disabled.py')
-rw-r--r--kvmd/plugins/msd/disabled.py47
1 files changed, 19 insertions, 28 deletions
diff --git a/kvmd/plugins/msd/disabled.py b/kvmd/plugins/msd/disabled.py
index eafbdd65..97835513 100644
--- a/kvmd/plugins/msd/disabled.py
+++ b/kvmd/plugins/msd/disabled.py
@@ -21,11 +21,11 @@
import asyncio
-import types
+import contextlib
from typing import Dict
-from typing import Type
from typing import AsyncGenerator
+from typing import Optional
from . import MsdOperationError
from . import BaseMsd
@@ -39,23 +39,22 @@ class MsdDisabledError(MsdOperationError):
# =====
class Plugin(BaseMsd):
- def get_state(self) -> Dict:
+ async def get_state(self) -> Dict:
return {
"enabled": False,
- "multi": False,
"online": False,
"busy": False,
- "uploading": False,
- "written": 0,
- "current": None,
"storage": None,
- "cdrom": None,
- "connected": False,
+ "drive": None,
+ "features": {
+ "multi": False,
+ "cdrom": False,
+ },
}
async def poll_state(self) -> AsyncGenerator[Dict, None]:
while True:
- yield self.get_state()
+ yield (await self.get_state())
await asyncio.sleep(60)
async def reset(self) -> None:
@@ -63,32 +62,24 @@ class Plugin(BaseMsd):
# =====
- async def connect(self) -> Dict:
+ async def set_params(self, name: Optional[str]=None, cdrom: Optional[bool]=None) -> None:
raise MsdDisabledError()
- async def disconnect(self) -> Dict:
+ async def connect(self) -> None:
raise MsdDisabledError()
- async def select(self, name: str, cdrom: bool) -> Dict:
+ async def disconnect(self) -> None:
raise MsdDisabledError()
- async def remove(self, name: str) -> Dict:
- raise MsdDisabledError()
-
- async def __aenter__(self) -> BaseMsd:
- raise MsdDisabledError()
-
- async def write_image_info(self, name: str, complete: bool) -> None:
- raise MsdDisabledError()
+ @contextlib.asynccontextmanager
+ async def write_image(self, name: str) -> AsyncGenerator[None, None]:
+ if True: # pylint: disable=using-constant-test
+ # XXX: Vulture hack
+ raise MsdDisabledError()
+ yield
async def write_image_chunk(self, chunk: bytes) -> int:
raise MsdDisabledError()
- async def __aexit__(
- self,
- _exc_type: Type[BaseException],
- _exc: BaseException,
- _tb: types.TracebackType,
- ) -> None:
-
+ async def remove(self, name: str) -> None:
raise MsdDisabledError()