[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v2 19/72] scripts/qemu-ga-client: Fix exception handling
From: |
John Snow |
Subject: |
[PATCH v2 19/72] scripts/qemu-ga-client: Fix exception handling |
Date: |
Tue, 3 Nov 2020 19:35:09 -0500 |
Fixes: 50d189c
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 a12e0e9b2a6e..c4fbb6165d54 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.26.2
- [PATCH v2 07/72] scripts/qom-fuse: Apply pylint rules, (continued)
- [PATCH v2 07/72] scripts/qom-fuse: Apply pylint rules, John Snow, 2020/11/03
- [PATCH v2 09/72] scripts/qom-fuse: Convert to QOMCommand, John Snow, 2020/11/03
- [PATCH v2 12/72] scripts/qom-fuse: add static type hints, John Snow, 2020/11/03
- [PATCH v2 11/72] scripts/qom-fuse: ensure QOMFuse.read always returns bytes, John Snow, 2020/11/03
- [PATCH v2 16/72] python: add optional fuse dependency, John Snow, 2020/11/03
- [PATCH v2 10/72] scripts/qom-fuse: use QOMCommand.qom_list(), John Snow, 2020/11/03
- [PATCH v2 13/72] scripts/qom-fuse: move to python/qemu/qmp/qom_fuse.py, John Snow, 2020/11/03
- [PATCH v2 15/72] python: add fuse command to 'qom' tools, John Snow, 2020/11/03
- [PATCH v2 18/72] scripts/qemu-ga-client: apply (most) flake8 rules, John Snow, 2020/11/03
- [PATCH v2 20/72] scripts/qemu-ga-client: replace deprecated optparse with argparse, John Snow, 2020/11/03
- [PATCH v2 19/72] scripts/qemu-ga-client: Fix exception handling,
John Snow <=
- [PATCH v2 26/72] python/qemu-ga-client: add entry point, John Snow, 2020/11/03
- [PATCH v2 29/72] scripts/qmp-shell: Apply flake8 rules, John Snow, 2020/11/03
- [PATCH v2 23/72] python/qmp: Correct type of QMPReturnValue, John Snow, 2020/11/03
- [PATCH v2 28/72] scripts/qmp-shell: apply isort rules, John Snow, 2020/11/03
- [PATCH v2 21/72] scripts/qemu-ga-client: add module docstring, John Snow, 2020/11/03
- [PATCH v2 27/72] scripts/qemu-ga-client: Add forwarder stub, John Snow, 2020/11/03
- [PATCH v2 25/72] scripts/qemu-ga-client: move to python/qemu/qmp/qemu_ga_client.py, John Snow, 2020/11/03
- [PATCH v2 17/72] scripts/qemu-ga-client: apply isort rules, John Snow, 2020/11/03
- [PATCH v2 14/72] scripts/qom-fuse: add redirection shim to python/qemu/qmp/qom-fuse.py, John Snow, 2020/11/03
- [PATCH v2 22/72] scripts/qemu-ga-client: apply (most) pylint rules, John Snow, 2020/11/03