[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 03/11] scripts/qemu-ga-client: Fix exception handling
From: |
John Snow |
Subject: |
[PATCH 03/11] scripts/qemu-ga-client: Fix exception handling |
Date: |
Fri, 4 Jun 2021 11:55:24 -0400 |
Fixes: 50d189c
These error classes aren't available anymore. Fix the bitrot.
Signed-off-by: John Snow <jsnow@redhat.com>
---
scripts/qmp/qemu-ga-client | 10 ++++------
1 file changed, 4 insertions(+), 6 deletions(-)
diff --git a/scripts/qmp/qemu-ga-client b/scripts/qmp/qemu-ga-client
index 566bddc89d..7aba09f0fe 100755
--- a/scripts/qmp/qemu-ga-client
+++ b/scripts/qmp/qemu-ga-client
@@ -56,8 +56,6 @@ class QemuGuestAgent(qmp.QEMUMonitorProtocol):
class QemuGuestAgentClient:
- error = QemuGuestAgent.error
-
def __init__(self, address):
self.qga = QemuGuestAgent(address)
self.qga.connect(negotiate=False)
@@ -137,7 +135,7 @@ class QemuGuestAgentClient:
self.qga.settimeout(timeout)
try:
self.qga.ping()
- except self.qga.timeout:
+ except TimeoutError:
return False
return True
@@ -269,11 +267,11 @@ def main(address, cmd, args):
try:
client = QemuGuestAgentClient(address)
- except QemuGuestAgent.error as e:
+ except OSError as err:
import errno
- print(e)
- if e.errno == errno.ECONNREFUSED:
+ print(err)
+ if err.errno == errno.ECONNREFUSED:
print('Hint: qemu is not running?')
sys.exit(1)
--
2.31.1
- [PATCH 00/11] python: move /scripts/qmp/gemu-ga-client.py to qemu.qmp package, John Snow, 2021/06/04
- [PATCH 03/11] scripts/qemu-ga-client: Fix exception handling,
John Snow <=
- [PATCH 01/11] scripts/qemu-ga-client: apply isort rules, John Snow, 2021/06/04
- [PATCH 05/11] scripts/qemu-ga-client: add module docstring, John Snow, 2021/06/04
- [PATCH 07/11] python/qmp: Correct type of QMPReturnValue, John Snow, 2021/06/04
- [PATCH 06/11] scripts/qemu-ga-client: apply (most) pylint rules, John Snow, 2021/06/04
- [PATCH 11/11] scripts/qemu-ga-client: Add forwarder shim, John Snow, 2021/06/04
- [PATCH 02/11] scripts/qemu-ga-client: apply (most) flake8 rules, John Snow, 2021/06/04
- [PATCH 08/11] scripts/qemu-ga-client: add mypy type hints, John Snow, 2021/06/04
- [PATCH 04/11] scripts/qemu-ga-client: replace deprecated optparse with argparse, John Snow, 2021/06/04
- [PATCH 09/11] scripts/qemu-ga-client: move to python/qemu/qmp/qemu_ga_client.py, John Snow, 2021/06/04
- [PATCH 10/11] python/qemu-ga-client: add entry point, John Snow, 2021/06/04