enable ASYNC, DTZ, YTT and EM lints

This commit is contained in:
Jörg Thalheim
2024-09-02 13:55:46 +02:00
parent d5440594be
commit 15ff74f7c2
98 changed files with 526 additions and 421 deletions

View File

@@ -58,7 +58,8 @@ class QgaSession:
self.sock.send(status_payload)
result = self.get_response()
if "error" in result and result["error"]["desc"].startswith("PID"):
raise Exception("PID could not be found")
msg = "PID could not be found"
raise Exception(msg)
if result["return"]["exited"]:
break
sleep(0.1)
@@ -75,7 +76,6 @@ class QgaSession:
else base64.b64decode(result["return"]["err-data"]).decode("utf-8")
)
if check and exitcode != 0:
raise Exception(
f"Command on guest failed\nCommand: {cmd}\nExitcode {exitcode}\nStdout: {stdout}\nStderr: {stderr}"
)
msg = f"Command on guest failed\nCommand: {cmd}\nExitcode {exitcode}\nStdout: {stdout}\nStderr: {stderr}"
raise Exception(msg)
return exitcode, stdout, stderr

View File

@@ -139,11 +139,14 @@ class QEMUMonitorProtocol:
try:
ret = self.__json_read(only_event=True)
except TimeoutError as e:
raise QMPTimeoutError("Timeout waiting for event") from e
msg = "Timeout waiting for event"
raise QMPTimeoutError(msg) from e
except OSError as e:
raise QMPConnectError("Error while reading from socket") from e
msg = "Error while reading from socket"
raise QMPConnectError(msg) from e
if ret is None:
raise QMPConnectError("Error while reading from socket")
msg = "Error while reading from socket"
raise QMPConnectError(msg)
self.__sock.settimeout(None)
def __enter__(self) -> "QEMUMonitorProtocol":