summaryrefslogtreecommitdiff
path: root/kvmd/apps
diff options
context:
space:
mode:
authorDevaev Maxim <[email protected]>2019-06-11 11:07:56 +0300
committerDevaev Maxim <[email protected]>2019-06-11 11:07:56 +0300
commit675abed41a839b35d15090398e7dff585cfb9989 (patch)
treebd0ff4ab3f0d2b4dff71a1fc9dd2acaab82e792e /kvmd/apps
parent8306b0e9a6a0b809ae998378d866392b42dbb34a (diff)
refactoring
Diffstat (limited to 'kvmd/apps')
-rw-r--r--kvmd/apps/kvmd/msd.py14
-rw-r--r--kvmd/apps/kvmd/server.py2
2 files changed, 8 insertions, 8 deletions
diff --git a/kvmd/apps/kvmd/msd.py b/kvmd/apps/kvmd/msd.py
index 019688da..70b871ee 100644
--- a/kvmd/apps/kvmd/msd.py
+++ b/kvmd/apps/kvmd/msd.py
@@ -65,17 +65,17 @@ class MsdOfflineError(MsdOperationError):
super().__init__("Mass-storage device is not found")
-class MsdAlreadyConnectedToServerError(MsdOperationError):
+class MsdAlreadyOnServerError(MsdOperationError):
def __init__(self) -> None:
super().__init__("Mass-storage is already connected to Server")
-class MsdAlreadyConnectedToKvmError(MsdOperationError):
+class MsdAlreadyOnKvmError(MsdOperationError):
def __init__(self) -> None:
super().__init__("Mass-storage is already connected to KVM")
-class MsdNotConnectedToKvmError(MsdOperationError):
+class MsdNotOnKvmError(MsdOperationError):
def __init__(self) -> None:
super().__init__("Mass-storage is not connected to KVM")
@@ -283,7 +283,7 @@ class MassStorageDevice: # pylint: disable=too-many-instance-attributes
try:
with self.__region:
if self.__on_kvm:
- raise MsdAlreadyConnectedToKvmError()
+ raise MsdAlreadyOnKvmError()
notify = True
gpio.write(self.__target_pin, False)
@@ -304,13 +304,13 @@ class MassStorageDevice: # pylint: disable=too-many-instance-attributes
@_msd_working
@aiotools.atomic
- async def connect_to_pc(self) -> Dict:
+ async def connect_to_server(self) -> Dict:
notify = False
state: Dict = {}
try:
with self.__region:
if not self.__on_kvm:
- raise MsdAlreadyConnectedToServerError()
+ raise MsdAlreadyOnServerError()
notify = True
gpio.write(self.__target_pin, True)
@@ -353,7 +353,7 @@ class MassStorageDevice: # pylint: disable=too-many-instance-attributes
self.__region.enter()
try:
if not self.__on_kvm:
- raise MsdNotConnectedToKvmError()
+ raise MsdNotOnKvmError()
self.__device_file = await aiofiles.open(self._device_info.path, mode="w+b", buffering=0)
self.__written = 0
return self
diff --git a/kvmd/apps/kvmd/server.py b/kvmd/apps/kvmd/server.py
index 16af2d9c..1b900334 100644
--- a/kvmd/apps/kvmd/server.py
+++ b/kvmd/apps/kvmd/server.py
@@ -465,7 +465,7 @@ class Server: # pylint: disable=too-many-instance-attributes
to = valid_kvm_target(request.query.get("to"))
return _json(await ({
"kvm": self.__msd.connect_to_kvm,
- "server": self.__msd.connect_to_pc,
+ "server": self.__msd.connect_to_server,
}[to])())
@_exposed("POST", "/msd/write")