Fixed connecting state assignment bug
This commit is contained in:
6
main.py
6
main.py
@@ -148,13 +148,14 @@ def findDiskNode(serial: str) -> str | None:
|
|||||||
|
|
||||||
|
|
||||||
def mountDisk(state: AppState) -> None:
|
def mountDisk(state: AppState) -> None:
|
||||||
|
state.diskState = "connecting"
|
||||||
node = findDiskNode(state.config.diskSerial)
|
node = findDiskNode(state.config.diskSerial)
|
||||||
try:
|
try:
|
||||||
subprocess.run(
|
subprocess.run(
|
||||||
["mkdir", "-p", f"/mnt/{state.config.diskSerial}"],
|
["mkdir", "-p", f"/mnt/{state.config.diskSerial}"],
|
||||||
check=True,
|
check=True,
|
||||||
)
|
)
|
||||||
sleep(2)
|
sleep(1)
|
||||||
subprocess.run(
|
subprocess.run(
|
||||||
[
|
[
|
||||||
"mount",
|
"mount",
|
||||||
@@ -165,7 +166,7 @@ def mountDisk(state: AppState) -> None:
|
|||||||
],
|
],
|
||||||
check=True,
|
check=True,
|
||||||
)
|
)
|
||||||
sleep(2)
|
sleep(1)
|
||||||
except subprocess.CalledProcessError:
|
except subprocess.CalledProcessError:
|
||||||
pass
|
pass
|
||||||
else:
|
else:
|
||||||
@@ -233,7 +234,6 @@ def main() -> None:
|
|||||||
and event.event == "connected"
|
and event.event == "connected"
|
||||||
and event.serial == state.config.diskSerial
|
and event.serial == state.config.diskSerial
|
||||||
):
|
):
|
||||||
state.diskState == "connecting"
|
|
||||||
mountDisk(state)
|
mountDisk(state)
|
||||||
|
|
||||||
except Empty:
|
except Empty:
|
||||||
|
|||||||
Reference in New Issue
Block a user