cdrom flag; written fix

This commit is contained in:
Devaev Maxim 2019-10-05 09:23:48 +03:00
parent a073113f38
commit e97d48b363
5 changed files with 12 additions and 7 deletions

View File

@ -481,7 +481,9 @@ class Server: # pylint: disable=too-many-instance-attributes
@_exposed("POST", "/msd/select")
async def __msd_select_handler(self, request: aiohttp.web.Request) -> aiohttp.web.Response:
return _json(await self.__msd.select(valid_msd_image_name(request.query.get("image_name"))))
image_name = valid_msd_image_name(request.query.get("image_name"))
cdrom = valid_bool(request.query.get("cdrom", "true"))
return _json(await self.__msd.select(image_name, cdrom))
@_exposed("POST", "/msd/remove")
async def __msd_remove_handler(self, request: aiohttp.web.Request) -> aiohttp.web.Response:

View File

@ -92,7 +92,7 @@ class BaseMsd(BasePlugin):
async def disconnect(self) -> Dict:
raise NotImplementedError
async def select(self, name: str) -> Dict:
async def select(self, name: str, cdrom: bool) -> Dict:
raise NotImplementedError
async def remove(self, name: str) -> Dict:

View File

@ -46,9 +46,10 @@ class Plugin(BaseMsd):
"online": False,
"busy": False,
"uploading": False,
"written": False,
"written": 0,
"current": None,
"storage": None,
"cdrom": None,
"connected": False,
}
@ -68,7 +69,7 @@ class Plugin(BaseMsd):
async def disconnect(self) -> Dict:
raise MsdDisabledError()
async def select(self, name: str) -> Dict:
async def select(self, name: str, cdrom: bool) -> Dict:
raise MsdDisabledError()
async def remove(self, name: str) -> Dict:

View File

@ -46,9 +46,10 @@ class Plugin(BaseMsd):
"online": False,
"busy": False,
"uploading": False,
"written": False,
"written": 0,
"current": None,
"storage": None,
"cdrom": None,
"connected": False,
}
@ -68,7 +69,7 @@ class Plugin(BaseMsd):
async def disconnect(self) -> Dict:
raise MsdCliOnlyError()
async def select(self, name: str) -> Dict:
async def select(self, name: str, cdrom: bool) -> Dict:
raise MsdCliOnlyError()
async def remove(self, name: str) -> Dict:

View File

@ -228,6 +228,7 @@ class Plugin(BaseMsd): # pylint: disable=too-many-instance-attributes
"written": self.__written,
"current": current,
"storage": storage,
"cdrom": None,
"connected": (not self.__on_kvm),
}
@ -317,7 +318,7 @@ class Plugin(BaseMsd): # pylint: disable=too-many-instance-attributes
await self.__state_queue.put(state or self.get_state())
@_msd_working
async def select(self, name: str) -> Dict:
async def select(self, name: str, cdrom: bool) -> Dict:
raise MsdMultiNotSupported()
@_msd_working